Uredi

Deli z drugimi prek


Queryable.DistinctBy Method

Definition

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

IQueryable<TSource>

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

IQueryable<TSource>

An IQueryable<T> that contains distinct elements from the source sequence.

Exceptions

source is null.

Applies to