Queryable.MinBy 方法

定義

多載

名稱 Description
MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>)

根據指定的鍵選擇函式,回傳通用 IQueryable<T> 的最小值。

MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TKey>)

根據指定的鍵選擇函式,回傳通用 IQueryable<T> 的最小值。

MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TSource>)
已淘汰.

根據指定的鍵選擇函式,回傳通用 IQueryable<T> 的最小值。

MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>)

來源:
Queryable.cs
來源:
Queryable.cs
來源:
Queryable.cs
來源:
Queryable.cs
來源:
Queryable.cs

根據指定的鍵選擇函式,回傳通用 IQueryable<T> 的最小值。

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static TSource MinBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector);
public static TSource? MinBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static TSource? MinBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector);
static member MinBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> -> 'Source
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
static member MinBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> -> 'Source
<Extension()>
Public Function MinBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey))) As TSource

類型參數

TSource

元素 source的類型。

TKey

比較元素的鑰匙類型。

參數

source
IQueryable<TSource>

一連串的值用以決定最小值。

keySelector
Expression<Func<TSource,TKey>>

一個用來提取每個元素鍵值的函式。

傳回

TSource

序列中鍵數最小的值。

屬性

例外狀況

sourcenull

source or 介面擷取的金鑰都無法實現IComparableIComparable<T>

適用於

MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TKey>)

來源:
Queryable.cs
來源:
Queryable.cs

根據指定的鍵選擇函式,回傳通用 IQueryable<T> 的最小值。

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static TSource MinBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector, System::Collections::Generic::IComparer<TKey> ^ comparer);
public static TSource? MinBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IComparer<TKey>? comparer);
static member MinBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IComparer<'Key> -> 'Source
<Extension()>
Public Function MinBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey)), comparer As IComparer(Of TKey)) As TSource

類型參數

TSource

元素 source的類型。

TKey

比較元素的鑰匙類型。

參數

source
IQueryable<TSource>

一連串的值用以決定最小值。

keySelector
Expression<Func<TSource,TKey>>

一個用來提取每個元素鍵值的函式。

comparer
IComparer<TKey>

比較 IComparer<T> 鑰匙。

傳回

TSource

序列中鍵數最小的值。

例外狀況

sourcenull

source or 介面擷取的金鑰都無法實現IComparableIComparable<T>

適用於

MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TSource>)

來源:
Queryable.cs
來源:
Queryable.cs
來源:
Queryable.cs
來源:
Queryable.cs
來源:
Queryable.cs

警告

The Queryable MinBy and MaxBy taking an IComparer<TSource> are obsolete. Use the new ones that take an IComparer<TKey>.

根據指定的鍵選擇函式,回傳通用 IQueryable<T> 的最小值。

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static TSource MinBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector, System::Collections::Generic::IComparer<TSource> ^ comparer);
[System.Obsolete("The Queryable MinBy and MaxBy taking an IComparer<TSource> are obsolete. Use the new ones that take an IComparer<TKey>.", DiagnosticId="SYSLIB0061", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static TSource? MinBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IComparer<TSource>? comparer);
public static TSource? MinBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IComparer<TSource>? comparer);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static TSource? MinBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IComparer<TSource>? comparer);
[<System.Obsolete("The Queryable MinBy and MaxBy taking an IComparer<TSource> are obsolete. Use the new ones that take an IComparer<TKey>.", DiagnosticId="SYSLIB0061", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member MinBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IComparer<'Source> -> 'Source
static member MinBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IComparer<'Source> -> 'Source
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
static member MinBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IComparer<'Source> -> 'Source
<Extension()>
Public Function MinBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey)), comparer As IComparer(Of TSource)) As TSource

類型參數

TSource

元素 source的類型。

TKey

比較元素的鑰匙類型。

參數

source
IQueryable<TSource>

一連串的值用以決定最小值。

keySelector
Expression<Func<TSource,TKey>>

一個用來提取每個元素鍵值的函式。

comparer
IComparer<TSource>

比較 IComparer<T> 鑰匙。

傳回

TSource

序列中鍵數最小的值。

屬性

例外狀況

sourcenull

source or 介面擷取的金鑰都無法實現IComparableIComparable<T>

適用於