Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
list.Min() 将最小值作为整数获取。我想在 List 中获取某个属性 X 的最小值的对象。我该怎么做?
看看MinByMoreLINQ - 或者我相信 Reactive Extensions 有类似的东西System.Interactive:
MinBy
System.Interactive
var cheapestProduct = products.MinBy(p => p.Price);
如果不止一项具有最低值,则将返回序列中最早的一项。