Export (0) Print
Expand All

Convert a Sequence to an Array

Use ToArray<TSource> to create an array from a sequence.

The following example uses ToArray<TSource> to immediately evaluate a query into an array and to get the third element.

            var custQuery =
                from cust in db.Customers
                where cust.City == "London" 
                select cust;
                Customer[] qArray = custQuery.ToArray();
Show:
© 2014 Microsoft