开发者

Order by in Linq

how can i 开发者_高级运维show null or empty fields in last by apply Orderby:

here is my code.

Var movies = _db.Movies.Orderby(c => c.Category).ThenBy(n => n.Name)


If I understand your question correctly:

Var movies = _db.Movies
    .OrderBy(c => c.Category==null?1:0)
    .Thenby(c => c.Category).ThenBy(n => n.Name)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜