I am trying to get the cleanest way to get the objects with the smallest values.
I know how to get just one :
list.OrderBy(d => d.size).FirstOrDefault();
But if there are multiple objects with the minimum size I want all of them.
Right now I am planning on doing:
var min = list.Min(d => size);
return list.Where(d => d.size = min);
Is there another linq method that maybe I'm looking over?
If there is no better way in C# is there maybe a cleaner solution in Java streams?