OrderBy仅列出日期而非时间列表

时间:2014-05-30 06:57:37

标签: c# linq

我有IList<customClass>

我的CustomClass: CreatedDate(DateTime), Name(string), Number(int)

我使用OrderBy(p => p.CreatedDate)

我的问题:我如何定制或找到一种方式只订购CreatedDate日期,不包括订单时间?

1 个答案:

答案 0 :(得分:6)

鉴于CreatedDate类型为DateTime,您可以执行以下操作。

OrderBy(p => p.CreatedDate.Date)