How to use linq to find the minimum

Posted by Danvil on Stack Overflow See other posts from Stack Overflow or by Danvil
Published on 2010-04-29T09:45:31Z Indexed on 2010/04/29 9:47 UTC
Read the original article Hit count: 316

Filed under:
|

I have a class A { public float Score; ... } and a List<A> items and would like to find the A which has minimal score.

Using items.Min(x => x.Score) gives the minimal score and not the instance with minimal score.

How can I get the instance with only iterating once through my Collection?

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ