I have a class Event that have two properties : “ID”, and “ExpirationTime”.
I have a list that have many events, some of them with the same ID.
I want to create an efficient LINQ query that will distinct the events by the ID, and for each ID keep the event with the smallest ExpirationTime.
Thanks!
The grouping is easy enough, but doing an efficient “MinBy” with standard LINQ to Objects is slightly messy:
It’s cleaner with a
MinByoperator, such as the one provided with MoreLinq.