Queryable.MinBy 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| 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>>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- 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>>
用于提取每个元素的键的函数。
返回
序列中具有最小键的值。
- 属性
例外
source 是 null。
没有从source实现或IComparable接口中提取的IComparable<T>键。
适用于
MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TKey>)
- Source:
- Queryable.cs
- Source:
- 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> 比较键。
返回
序列中具有最小键的值。
例外
source 是 null。
没有从source实现或IComparable接口中提取的IComparable<T>键。
适用于
MinBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TSource>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- 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> 比较键。
返回
序列中具有最小键的值。
- 属性
例外
source 是 null。
没有从source实现或IComparable接口中提取的IComparable<T>键。