Why the code below returns nothing when I try to query an IList type object?
IList<Person> personRecord = new List<Person>
{
new Person{ Name = "Samuel"},
new Person{ Name = "Kenny Sammy"},
new Person{ Name = "Jame Sam Lee"}
};
var names = from b in personRecord
where personRecord.Any(d => d.Name == "Sam")
select b;
return names.ToList();
Don't use
Anysimply use the condition inWhereclause like:or with a method syntax:
If you are looking to match partial contents then use
Containslike:To compare partial content with ignoring case use
IndexOflike: