我正在尝试按日期对接口列表进行排序,但我无法弄清楚。
var agencyList = new List<INewsItemBE>();
var item = new News1BE();
//add items
agencyList.Add(item)
var item = new News2BE();
//add items
agencyList.Add(item);
添加项目后,我想agencyList用这样的方式按日期排序,但我无法让它工作。
agencyList.Sort(delegate (News1BE c1, News1BE c2) { return c1.PublishDate.CompareTo(c2.PublishDate); });
agencyList.Sort(delegate (News1BE a, News1BE b) => a.PublishDate.CompareTo(b.PublishDate));
agencyList = agencyList.OrderBy(x => cant find anything at x.).ToList();
皈依舞
富国沪深
相关分类