EnumerableRowCollectionExtensions.Cast(EnumerableRowCollection) EnumerableRowCollectionExtensions.Cast(EnumerableRowCollection) EnumerableRowCollectionExtensions.Cast(EnumerableRowCollection) EnumerableRowCollectionExtensions.Cast(EnumerableRowCollection) Method

定义

EnumerableRowCollection 的元素转换为指定的类型。Converts the elements of an EnumerableRowCollection to the specified type.

此 API 支持产品基础结构,不能在代码中直接使用。

public:
generic <typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Data::EnumerableRowCollection<TResult> ^ Cast(System::Data::EnumerableRowCollection ^ source);
public static System.Data.EnumerableRowCollection<TResult> Cast<TResult> (this System.Data.EnumerableRowCollection source);
static member Cast : System.Data.EnumerableRowCollection -> System.Data.EnumerableRowCollection<'Result>
<Extension()>
Public Function Cast(Of TResult) (source As EnumerableRowCollection) As EnumerableRowCollection(Of TResult)

类型参数

TResult

源中的元素要转换成的类型。The type to convert the elements of source to.

参数

source
EnumerableRowCollection EnumerableRowCollection EnumerableRowCollection EnumerableRowCollection

包含要转换的元素的 EnumerableRowCollectionThe EnumerableRowCollection that contains the elements to be converted.

返回

一个 EnumerableRowCollection,其中包含已转换为指定类型的源序列的每个元素。An EnumerableRowCollection that contains each element of the source sequence converted to the specified type.

异常

序列中的元素不能强制转换为 TResult 类型。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. 此方法表示的查询在枚举对象之前不会执行, 方法是直接调用其GetEnumerator方法, 或者通过在foreach视觉C#对象中For Each或在 Visual Basic 中使用。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.

适用于

另请参阅