O'Reilly logo

Pro LINQ: Language Integrated Query in C# 2008 by Joseph C. Rattz Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required