5
Doubt regarding the construction and performance of querys using Query Syntax
and Method Syntax
/ LINQ
Query Syntax:
var VendorQuery = from v in vendors
where v.CompanyName.Contains("Toy")
orderby v.CompanyName
select v;
Method Syntax
var vendorQuery = vendors
.Where(v => v.CompanyName.Contains("Toy"))
.OrderBy(v => v.CompanyName);
Obs: As querys above are fictitious, just to illustrate.
- In both situations the same query is mounted?
- Assuming I have to do a relatively "heavy" search, it does difference use one or the other?
As far as I know yes, in both scenarios the result is the same. Regarding the "heavy" query, it depends, weighed in record numbers or with many
JOIN
orGROUP BY
?– João Martins