My question uses the following code -
string searchString = dropdownlist.SelectedValue;
List objects = (from o in Object.List()
where dropdownlist.SelectedIndex <= 0 ||
o.CustomField.Contains(searchString)
orderby o.Date descending
select order).ToList();
The situation I am running into is as follows - The items in the drop down list are generic messages such as "Customer '{0}' has '{1}' orders". On the object side, o.CustomField would look something like "Customer 'Bob' has '5' orders". Obviously, this means that
o.CustomField.Contains(searchString)
will not return anything. I've been looking into wildcards but have not been able to achieve a successful return. This is what I was trying for a wildcard set up:
searchString = dropdownlist.SelectedValue.Replace("{0}", "*").Replace("{1}", "*");
I'm wondering if there is any cleaner way than to sit around and parse out all the different substrings between '{' or '}'.