I need to determine if any of the List
s contained in the Dictionary
contain the specified value. I'm new to LINQ, so is the following the correct way to achieve this?
Dictionary lotsOfStuff = new Dictionary<string, List<string>>();
string searchString;
// populate lotsOfStuff and searchString...
// detemine if any of the values of lotsOfStuff contain searchString
bool existsInDictionary = lotsOfStuff.Values.Any(values => values.Contains(searchString));
And if the above will work, is there any way to make it more correct or more optimal/concise?
Thanks and Happy New Year! :)