I'm not sure if this is even possible, as far as I can tell, it isn't, but I have a dictionary and I want to find the Min() of values, but return either the KVP or Key. Currently I am using orderby, but I feel like that is going to be super inefficient once this grows large enough.
You can use MoreLinq and its MinBy
method:
var pair = dictionary.MinBy(x => x.Value);
var key = pair.Key;
(And yes, this is O(N) rather than O(N log N) - more efficient than ordering. It won't need as much memory, either.)
See more on this question at Stackoverflow