Megosztás a következőn keresztül:


IEnumerableExtensions.Distinct<TSource,TKeyType> Method

Definition

Returns a distinct collection based on a key.

public static System.Collections.Generic.IEnumerable<TSource> Distinct<TSource,TKeyType> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKeyType> keySelector, System.Collections.Generic.IEqualityComparer<TKeyType> comparer = default);
static member Distinct : seq<'Source> * Func<'Source, 'KeyType> * System.Collections.Generic.IEqualityComparer<'KeyType> -> seq<'Source>
<Extension()>
Public Iterator Function Distinct(Of TSource, TKeyType) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKeyType), Optional comparer As IEqualityComparer(Of TKeyType) = Nothing) As IEnumerable(Of TSource)

Type Parameters

TSource

The source type.

TKeyType

The key type.

Parameters

source
IEnumerable<TSource>

The source collection.

keySelector
Func<TSource,TKeyType>

The key selector.

comparer
IEqualityComparer<TKeyType>

The comparer.

Returns

IEnumerable<TSource>

Applies to