Queryable.DistinctBy Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>) |
Returns distinct elements from a sequence according to a specified key selector function. |
DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IEqualityComparer<TKey>) |
Returns distinct elements from a sequence according to a specified key selector function. |
DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
Returns distinct elements from a sequence according to a specified key selector function.
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);
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)
Type Parameters
- TSource
The type of the elements of source
.
- TKey
The type of key to distinguish elements by.
Parameters
- source
- IQueryable<TSource>
The sequence to remove duplicate elements from.
- keySelector
- Expression<Func<TSource,TKey>>
A function to extract the key for each element.
Returns
An IQueryable<T> that contains distinct elements from the source sequence.
Exceptions
source
is null
.
Applies to
DistinctBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IEqualityComparer<TKey>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
Returns distinct elements from a sequence according to a specified key selector function.
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);
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)
Type Parameters
- TSource
The type of the elements of source
.
- TKey
The type of key to distinguish elements by.
Parameters
- source
- IQueryable<TSource>
The sequence to remove duplicate elements from.
- keySelector
- Expression<Func<TSource,TKey>>
A function to extract the key for each element.
- comparer
- IEqualityComparer<TKey>
An IEqualityComparer<T> to compare keys.
Returns
An IQueryable<T> that contains distinct elements from the source sequence.
Exceptions
source
is null
.
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示