EnumerableRowCollectionExtensions.Where<TRow> 方法

定義

根據指定的述詞來篩選資料列序列。

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

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

類型參數

TRow

source 中資料列項目的型別,通常是 DataRow

參數

source
EnumerableRowCollection<TRow>

EnumerableRowCollection,包含要篩選的 DataRow 項目。

predicate
Func<TRow,Boolean>

用來測試每個項目是否符合條件的函式。

傳回

OrderedEnumerableRowCollection<TRow>,其中包含輸入序列中符合條件的資料列。

備註

此方法是使用延後執行來實作。 立即傳回值是物件,可儲存執行動作所需的所有資訊。 除非直接在 GetEnumerator Visual C# 或 Visual Basic 中使用 foreach 來列舉對象,否則 For Each 不會執行這個方法所表示的查詢。

適用於

另請參閱