I have a List of objects in C#. All of the objects contain a property ID. There are several objects that have the same ID property.
How can I trim the List (or make a
If you want to avoid using a third-party library, you could do something like:
var bar = fooArray.GroupBy(x => x.Id).Select(x => x.First()).ToList();
That will group the array by the Id property, then select the first entry in the grouping.