Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is more performant in Linq multiple order by?

which of the sorted lists below is more performant:

var sortedList = data.OrderBy(row => row.Fullname).ThenBy(row => row.Age);

or this one:

var sortedList = from row in data 
                 orderby row.Fullname, row.Age
                 select row;
like image 350
Junior Mayhé Avatar asked Dec 06 '22 22:12

Junior Mayhé


2 Answers

Query syntax is being converted to Method syntax by compiler, so they are the same.

like image 191
abatishchev Avatar answered Dec 10 '22 01:12

abatishchev


They both will be converted to the same expression.

like image 24
zerkms Avatar answered Dec 10 '22 03:12

zerkms