111,120
社区成员
发帖
与我相关
我的任务
分享
if (list.Count(x => x.DutyType == "1") > 0)
{
ReList.Add(list.Where(x => x.DutyType == "1").OrderByDescending(x => x.Number).FirstOrDefault());
}
if (list.Count(x => x.DutyType == "2") > 0)
{
ReList.Add(list.Where(x => x.DutyType == "2").OrderByDescending(x => x.Number).FirstOrDefault());
}
if (list.Count(x => x.DutyType == "3") > 0)
{
ReList.Add(list.Where(x => x.DutyType == "3").OrderByDescending(x => x.Number).FirstOrDefault());
}
var result = from x in list
group x by x.DutyType
into g
select (from y in g orderby y.Number descending select y).FirstOrDefault();