Hello
foreach (var person in peopleList.Where(person => person.FirstName == "Messi"))
{
selectPeople.Add(person);
}
I am just wondering if there is any way to simplify this using LINQ.
Like rather than look at all the people I was trying to use LINQ to just fill a list with the "Messi"'s... was trying something like...
var selectPeople = peopleList.Select(x=>x.FirstName=="Messi");
Then I could just add everyone in that list without a check. But it doesn't quite work as planned.
Maybe there's no point simplifying that expression. But the question seemed worthwhile just to strengthen my LINQ knowledge.