tags:

views:

33

answers:

1
+1  Q: 

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)
+3  A: 

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)
Andrew Barber