Reputation: 11317
I have:
var results = response.Xml.Descendants("M").Where(foo => foo.Value.Contains("john"));
How do I change this to be:
List<string> ValidUsers = new List<string>();
ValidUsers.Add("John");
ValidUsers.Add("Smurf");
var results = response.Xml.Descendants("M")
.Where(foo => foo.Value.Contains(ValidUsers));
Upvotes: 0
Views: 55
Reputation: 11317
Figured it out:
var results = doc.Descendants("M")
.Where(foo => ValidUsers.Any(s => foo.Value.Contains(s)));
Upvotes: 0
Reputation: 6771
Switch it (just a guess, not testet).
Not foo.Value.Contains(ValidUsers)
but ValidUsers.Contains(foo.Value)
.
Upvotes: 1