EnumerableRowCollectionExtensions.Select(EnumerableRowCollection<TRow>, Func<TRow,S>) EnumerableRowCollectionExtensions.Select(EnumerableRowCollection<TRow>, Func<TRow,S>) EnumerableRowCollectionExtensions.Select(EnumerableRowCollection<TRow>, Func<TRow,S>) EnumerableRowCollectionExtensions.Select(EnumerableRowCollection<TRow>, Func<TRow,S>) Method

定义

EnumerableRowCollection<TRow> 中的每个元素投影到新窗体。Projects each element of an EnumerableRowCollection<TRow> into a new form.

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

public:
generic <typename TRow, typename S>
[System::Runtime::CompilerServices::Extension]
 static System::Data::EnumerableRowCollection<S> ^ Select(System::Data::EnumerableRowCollection<TRow> ^ source, Func<TRow, S> ^ selector);
public static System.Data.EnumerableRowCollection<S> Select<TRow,S> (this System.Data.EnumerableRowCollection<TRow> source, Func<TRow,S> selector);
static member Select : System.Data.EnumerableRowCollection<'Row> * Func<'Row, 'S> -> System.Data.EnumerableRowCollection<'S>
<Extension()>
Public Function Select(Of TRow, S) (source As EnumerableRowCollection(Of TRow), selector As Func(Of TRow, S)) As EnumerableRowCollection(Of S)

类型参数

TRow

source 中行元素的类型,通常为 DataRowThe type of the row elements in source, typically DataRow.

S

TRow 将转换成的类型。The type that TRow will be transformed into.

参数

source
EnumerableRowCollection<TRow> EnumerableRowCollection<TRow> EnumerableRowCollection<TRow> EnumerableRowCollection<TRow>

一个 EnumerableRowCollection<TRow>,其中包含要对其调用转换函数的 DataRow 元素。An EnumerableRowCollection<TRow> containing the DataRow elements to invoke a transform function upon.

selector
Func<TRow,S>

应用于每个元素的转换函数。A transform function to apply to each element.

返回

一个 EnumerableRowCollection<TRow>,其元素是对 source 的每个元素调用转换函数得到的结果。An EnumerableRowCollection<TRow> whose elements are the result of invoking the transform function on each element of source.

注解

此方法是使用延迟执行实现的。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. 在枚举对象之前,不会执行由此方法表示的查询,方法是:直接调用其 @no__t 0 方法,或者使用视觉C#对象中的 @no__t 或 @no__t 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.

此投影方法需要 selector 的转换函数为源序列中的每个值生成一个值,@no__t 为-1。This projection method requires the transform function, selector, to produce one value for each value in the source sequence, source. 如果 selector 返回本身为集合的值,则由使用者手动遍历个子序列。If selector returns a value that is itself a collection, it is up to the consumer to traverse the subsequences manually.

适用于