Let say I have a list of objects with the following properties (FirstName, LastName):
var people = new []
{
new { FirstName = "John", LastName = "Smith" },
new { FirstName = "Dale", LastName = "Smith" },
new { FirstName = "Jermey", LastName = "Ducey" },
}.ToList();
Using Linq how can I return just the object containing "Jeremy, Ducey" if I am search by unique last names.
Distinct()
still returns one instance of smith, and every answer leads me to GroupBy()
which only return groups properties OR Distinct()
which doesn't do what I want.