Queryable.DistinctBy Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Перегрузки
| Имя | Описание |
|---|---|
| DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>) |
Возвращает отдельные элементы из последовательности в соответствии с указанной функцией селектора ключей. |
| DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IEqualityComparer<TKey>) |
Возвращает отдельные элементы из последовательности в соответствии с указанной функцией селектора ключей. |
DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>)
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
Возвращает отдельные элементы из последовательности в соответствии с указанной функцией селектора ключей.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IQueryable<TSource> ^ DistinctBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector);
public static System.Linq.IQueryable<TSource> DistinctBy<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 System.Linq.IQueryable<TSource> DistinctBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector);
static member DistinctBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> -> System.Linq.IQueryable<'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 DistinctBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function DistinctBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey))) As IQueryable(Of TSource)
Параметры типа
- TSource
Тип элементов source.
- TKey
Тип ключа для различения элементов по.
Параметры
- source
- IQueryable<TSource>
Последовательность для удаления повторяющихся элементов.
- keySelector
- Expression<Func<TSource,TKey>>
Функция для извлечения ключа для каждого элемента.
Возвращаемое значение
Объект, IQueryable<T> содержащий отдельные элементы из исходной последовательности.
- Атрибуты
Исключения
source равно null.
Применяется к
DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IEqualityComparer<TKey>)
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
- Исходный код:
- Queryable.cs
Возвращает отдельные элементы из последовательности в соответствии с указанной функцией селектора ключей.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IQueryable<TSource> ^ DistinctBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Linq.IQueryable<TSource> DistinctBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? 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 System.Linq.IQueryable<TSource> DistinctBy<TSource,TKey>(this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member DistinctBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.IQueryable<'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 DistinctBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Linq.IQueryable<'Source>
<Extension()>
Public Function DistinctBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey)), comparer As IEqualityComparer(Of TKey)) As IQueryable(Of TSource)
Параметры типа
- TSource
Тип элементов source.
- TKey
Тип ключа для различения элементов по.
Параметры
- source
- IQueryable<TSource>
Последовательность для удаления повторяющихся элементов.
- keySelector
- Expression<Func<TSource,TKey>>
Функция для извлечения ключа для каждого элемента.
- comparer
- IEqualityComparer<TKey>
Сравнение IEqualityComparer<T> ключей.
Возвращаемое значение
Объект, IQueryable<T> содержащий отдельные элементы из исходной последовательности.
- Атрибуты
Исключения
source равно null.