// Build a query expression using query operators.
var subset = from g in currentVideoGames
where g.Length > 6 orderby g select g;
// Print out the results.
foreach (var s in subset)
Console.WriteLine("Item: {0}", s);
}
The obvious benefit of using C# query operators to build query expressions is the fact that the
Func<> delegates and calls on the Enumerable type are out of sight and out of mind, as it is the job of
the C# compiler to perform this translation. To be sure, building LINQ expressions using various
query operators (from, in, where, orderby, etc.) is the most common and most straightforward
approach.
Do'stlaringiz bilan baham: |