Just wondering, does it matter in which sequence the LINQ methods are added?
Eg.
using(MyDataContext context = new MyDataContext())
{
var user = context.Users
.Where(u => u.UserName.StartsWith("t"))
.OrderByDescending(u => u.CreatedDate)
.FirstOrDefault();
}
and this are completely the same?
using(MyDataContext context = new MyDataContext())
{
var user = context.Users
.OrderByDescending(u => u.CreatedDate)
.Where(u => u.UserName.StartsWith("t"))
.FirstOrDefault();
}
Of course I can have all methods tested one by one, but I'd like to have some general idea about the logic.
So:
- Other than methods like FirstOrDefault(), ToList() and other methods that really trigger the execution is it of any importance to have some type of order in the LINQ statement?
Thanks again!