Enumerable::ToArray<TSource> Method
Silverlight
Creates an array from a IEnumerable<T>.
Namespace: System.Linq
Assembly: System.Core (in System.Core.dll)
Type Parameters
- TSource
The type of the elements of source.
Parameters
- source
- Type: System.Collections.Generic::IEnumerable<TSource>
An IEnumerable<T> to create an array from.
Return Value
Type: array<TSource>An array that contains the elements from the input sequence.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<TSource>. When you use instance method syntax to call this method, omit the first parameter.| Exception | Condition |
|---|---|
| ArgumentNullException | source is nullptr. |
The ToArray<TSource>(IEnumerable<TSource>) method forces immediate query evaluation and returns an array that contains the query results. You can append this method to your query in order to obtain a cached copy of the query results.
ToList<TSource> has similar behavior but returns a List<T> instead of an array.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Community Additions
ADD
Show: