Multi column Order By in LINQ
There is multiple ways to do multi columns sorting/order by with LINQ query
var employee = _db.Employee.Orderby(e => e.Ename).ThenBy(s => s.Salary);
OR
var employee = from emp in Employee
orderby emp.Ename, emp.Salary ascending
select emp;
OR
OR
var employee = from emp in Employee
orderby emp.Ename ascending, emp.Salary descending
select emp;
No comments:
Post a Comment