The Nondeferred Operators by Purpose

The nondeferred Standard Query Operators are organized by their purposes in this section.

Conversion

The following conversion operators provide a simple and convenient way of converting sequences to other collection types.

ToArray

The ToArray operator creates an array of type T from an input sequence of type T.

Prototypes

There is one prototype I will cover.

Example. The ToArray Prototype
public static T[] ToArray<T>(
  this IEnumerable<T> source);

This operator takes an input sequence named source, of type T elements, and returns an array of type T elements.

Exceptions

ArgumentNullException is thrown if the source argument is null.

Examples

For an example demonstrating the ToArray operator, I need a sequence ...

Get Pro LINQ: Language Integrated Query in C# 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.