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

Ste*_*Lam 1 c# linq

我有 IList<customClass>

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

我用 OrderBy(p => p.CreatedDate)

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

Sri*_*vel 6

鉴于这种CreatedDate类型,DateTime您可以执行以下操作.

OrderBy(p => p.CreatedDate.Date)
Run Code Online (Sandbox Code Playgroud)