I have a collection called navigationList . This list contains customer objects. The client has the Town property.
The list contains 5 customers: 2 with the city of New York and 5 with the city of Madrid.
I want the list to have only 2 clients. 1 with the city of New York and one with Madrid. If 2 is from New York, I want the latter. The same goes for Madrid.
What will the LINQ statement look like?
var newList = navigationList.GroupBy(c => c.Town)
source share