I have a list of class Products:
class Products
{
public string Name { get; set; }
public string Size { get; set; }
public string ProductId { get; set; }
public string Category { get; set; }
}
I would like to use one TextBox to search through any matching products utilizing a wildcard value. This would return me a list of items where all values in the search string are found somewhere in the four properties listed above.
As of now, I'm using string[] values = searchText.Split("*".ToCharArray)
to seperate the values of the search string into an array of strings (based on an asterisk wildcard). From there, I get stumped, since I want to search for all values of the search string in all properties of the class.
I tried to figure it out using a complex LINQ statement, but I have not been able to figure it out how to make this work. I don't know how to build a Where statement when I don't know how many values I'm going need to test against my four properties.