EnumerableRowCollectionExtensions.OrderBy 方法

定義

依遞增順序排序 EnumerableRowCollection 的資料列。

多載

OrderBy<TRow,TKey>(EnumerableRowCollection<TRow>, Func<TRow,TKey>)

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

依據指定的索引鍵,按遞增順序排序 EnumerableRowCollection 的資料列。

OrderBy<TRow,TKey>(EnumerableRowCollection<TRow>, Func<TRow,TKey>, IComparer<TKey>)

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

依據指定的索引鍵和比較子,按遞增順序排序 EnumerableRowCollection 的資料列。

OrderBy<TRow,TKey>(EnumerableRowCollection<TRow>, Func<TRow,TKey>)

依據指定的索引鍵,按遞增順序排序 EnumerableRowCollection 的資料列。

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

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

類型參數

TRow

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

TKey

keySelector 所傳回之索引鍵的型別。

參數

source
EnumerableRowCollection<TRow>

EnumerableRowCollection,包含要排序的 DataRow 項目。

keySelector
Func<TRow,TKey>

用來從項目擷取索引鍵的函式。

傳回

OrderedEnumerableRowCollection<TRow>

OrderedEnumerableRowCollection<TRow>,其項目排序依據是指定的索引鍵。

備註

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

另請參閱

適用於

OrderBy<TRow,TKey>(EnumerableRowCollection<TRow>, Func<TRow,TKey>, IComparer<TKey>)

依據指定的索引鍵和比較子,按遞增順序排序 EnumerableRowCollection 的資料列。

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

public:
generic <typename TRow, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static System::Data::OrderedEnumerableRowCollection<TRow> ^ OrderBy(System::Data::EnumerableRowCollection<TRow> ^ source, Func<TRow, TKey> ^ keySelector, System::Collections::Generic::IComparer<TKey> ^ comparer);
public static System.Data.OrderedEnumerableRowCollection<TRow> OrderBy<TRow,TKey> (this System.Data.EnumerableRowCollection<TRow> source, Func<TRow,TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer);
static member OrderBy : System.Data.EnumerableRowCollection<'Row> * Func<'Row, 'Key> * System.Collections.Generic.IComparer<'Key> -> System.Data.OrderedEnumerableRowCollection<'Row>
<Extension()>
Public Function OrderBy(Of TRow, TKey) (source As EnumerableRowCollection(Of TRow), keySelector As Func(Of TRow, TKey), comparer As IComparer(Of TKey)) As OrderedEnumerableRowCollection(Of TRow)

類型參數

TRow

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

TKey

keySelector 所傳回之索引鍵的型別。

參數

source
EnumerableRowCollection<TRow>

EnumerableRowCollection,包含要排序的 DataRow 項目。

keySelector
Func<TRow,TKey>

用來從項目擷取索引鍵的函式。

comparer
IComparer<TKey>

用來比較金鑰的 IComparer<T>

傳回

OrderedEnumerableRowCollection<TRow>

OrderedEnumerableRowCollection<TRow>,其項目是根據指定的索引鍵和比較子進行排序。

備註

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

另請參閱

適用於