SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 96 | Next

Scott Klein

"Professional LINQ"

NET Common Language Runtime (CLR) really doesn??™t understand query
syntax. Thus, at compile time, query expressions are translated into method calls because this is what the
CLR understands.
Here??™s the method syntax version of the preceding query:
IEnumerable query = contact.Where(c => c.FirstName.StartsWith("S"));
It is recommended that you use query syntax whenever possible simply because it is easier to read,
understand, and maintain. However, as you can see from the two preceding examples, there is no semantic
difference between method syntax and query syntax. Therefore, this section discusses both query
syntax and method syntax to provide you a good understanding of these syntaxes in queries and how to
use them in query expressions.
This next example gets a bit more complicated by adding an additional filter:
IEnumerable query =
from c in contact
where c.FirstName.StartsWith("S")
&& c.LastName.StartsWith("A")
select c;
The method syntax of this is as follows:
IEnumerable query = contact.Where(a => a.


Pages:
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6