EnumerableRowCollectionExtensions.Cast<'TResult> Method (EnumerableRowCollection)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Converts the elements of an EnumerableRowCollection to the specified type. This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Namespace:   System.Data
Assembly:  System.Data.DataSetExtensions (in System.Data.DataSetExtensions.dll)

static member Cast<'TResult> : 
        source:EnumerableRowCollection -> EnumerableRowCollection<'TResult>


Type: System.Data.EnumerableRowCollection

The EnumerableRowCollection that contains the elements to be converted.

Return Value

Type: System.Data.EnumerableRowCollection<'TResult>

An EnumerableRowCollection that contains each element of the source sequence converted to the specified type.

Type Parameters


The type to convert the elements of source to.

Exception Condition

source is null.


An element in the sequence cannot be cast to type TResult.

This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its GetEnumerator method directly or by using foreach in Visual C# or For Each in Visual Basic.

.NET Framework
Available since 3.5
Return to top