I have a table was named “MYTABLE”. That have two columns “FIRSTNAME” and “LASTNAME”.
Two query below returned same result is IQueryable<MYTABLE>
dataContext.MYTABLEs.Where(f => f.FIRSTNAME == firstName && f.LASTNAME == lastName);
from t in dataContext.MYTABLEs
where t.FIRSTNAME == firstName && t.LASTNAME == lastName select t;
What is the difference? which one in the two query faster?
They’re both the same. You can write LINQ queries using lambda (method) syntax (the 1st approach) or query syntax (the 2nd approach). The latter is simply syntactic sugar and both get compiled to the same thing.
From the LINQ Query Syntax versus Method Syntax MSDN article:
A similar question can be found here.