I have an array of strings
string[] tmp = foo();
If NONE of the strings in foo contain either "bar" or "baz" I want to execute some code. Is this the proper way to query this object?
if(!tmp.Any(p => p.ToLower().Contains("bar") || p.ToLower().Contains("baz"))
doSomething();
The || seems silly. Should I be using a regular expression here or is there an even better way to be doing this? ***Also note the values in tmp are like "bar=someValue" like a query string. This code works ok but I'm certain it can written better. Thanks for any tips of feedback.
||seem silly? You want to do something if either X or Y is true for any item. Seems entirely reasonable to me.p.IndexOf("bar", StringComparison.CurrentCultureIgnoreCase) < 0and avoid theToLower()call.