list.OrderBy(p=>p.CommonPrice).FirstOrDefault();
先降序排序喽!再取最后一个。
CommAttrSelect minModel = list.OrderByDescending(p=>p.CommonPrice).LastOrDefault();
排序可比Min的消耗要高哦
-----
加我微信214710841, 可以一起交流哦
好好看看IEnumerable的延迟求值计算吧
CommAttrSelect minModel = list.FirstOrDefault(p => p.CommonPrice == list.Min(p => p.CommonPrice));
下载个Reshaper,lambda和Linq轻松给你搞定
Reshaper 少用吧
var minModel = list.OrderByDescending(p=>p.CommonPrice).LastOrDefault();
list.OrderByDescending(p=>p.CommonPrice).FirstOrDefault()
NET高级QQ群:479601208 --欢迎大家加入讨论技术
IList<CommAttrSelect> list = new List<CommAttrSelect>();
var model = list.OrderByDescending(s => s.CommonPrice).FirstOrDefault();
/// <summary>
/// 实体
/// </summary>
public class CommAttrSelect
{
public decimal CommonPrice { get; set; }
}