PART I
C h a p t e r 1 9 :
L I N Q
581
PART IPART I
of a query in an array.
ToList( )
returns the results of a query in the form of a
List
collection.
(See Chapter 24 for a discussion of collections.) In both cases, the query is executed to obtain
the results. For example, the following sequence obtains an array of the results generated by
the
posNums
query just shown. It then displays the results.
int[] pnums = posNum.ToArray(); // query executes here
foreach(int i in pnums)
Console.Write(i + " ");
}
Expression Trees
Another new LINQ-related feature is the
expression tree.
An expression tree is a representation
of a lambda expression as data. Thus, an expression tree, itself, cannot be executed. It can,
however, be converted into an executable form. Expression trees are encapsulated by the
Do'stlaringiz bilan baham: |