我有两个List
,promolist
和packagelist
。 packagelist
数据必须是第一个packagelist
,list
必须OrderByDescending
和ThenByDescending
level
然后totalclick
贝娄是我试过的
promolist.OrderByDescending(o => o.packagelevel.level).ThenByDescending(o => o.totalclick);
promolist.AddRange(packagelist.OrderByDescending(o => o.packagelevel.level).ThenByDescending(o => o.totalclick));
return promolist;
结果几乎是我想要的,promolist
在packagelist
之前,packagelist
正确排序,只有 promolist
没有做任何{{1 }或OrderByDescending
答案 0 :(得分:2)
OrderBy
的结果是您需要分配和评估的新枚举。你不会对结果做任何事情。
你需要这个:
promolist = promolist.OrderByDescending(o => o.packagelevel.level)
.ThenByDescending(o => o.totalclick)
.ToList();