IEnumerable<T>.Min(Func<T, TResult>)
performs transformation first and then selects minimum value. Is there any standard linq operation I can perform to return original element? I get that I can use Min() and then Where() to achieve this, but this has running time of O(2n) instead of optimal O(n). To illustrate what I mean:
var fooList = new List<Foo>
{
new Foo { Bar1 = 10, Bar2 = 0 },
new Foo { Bar1 = 8, Bar2 = 1 },
new Foo { Bar1 = 6, Bar2 = 7 }
};
var foo = fooList.Min(f => f.Bar2); // magic happens here
// foo is of type Foo with Bar1 = 10 Bar2 = 0