AsyncEnumerable.DistinctBy Metoda

Definice

Přetížení

Name Description
DistinctBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>)

Vrátí odlišné prvky ze sekvence podle zadané funkce selektoru klíče.

DistinctBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Vrátí odlišné prvky ze sekvence podle zadané funkce selektoru klíče.

DistinctBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>)

Zdroj:
DistinctBy.cs
Zdroj:
DistinctBy.cs
Zdroj:
DistinctBy.cs

Vrátí odlišné prvky ze sekvence podle zadané funkce selektoru klíče.

public static System.Collections.Generic.IAsyncEnumerable<TSource> DistinctBy<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member DistinctBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function DistinctBy(Of TSource, TKey) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TSource)

Parametry typu

TSource

Typ prvků .source

TKey

Typ klíče k rozlišení prvků.

Parametry

source
IAsyncEnumerable<TSource>

Sekvence pro odebrání duplicitních prvků.

keySelector
Func<TSource,CancellationToken,ValueTask<TKey>>

Funkce, která extrahuje klíč pro každý prvek.

comparer
IEqualityComparer<TKey>

Porovnávat IEqualityComparer<T> klíče.

Návraty

IAsyncEnumerable<TSource>

Obsahuje IAsyncEnumerable<T> odlišné prvky ze zdrojové sekvence.

Výjimky

keySelector je null.

Poznámky

Tato metoda se implementuje pomocí odloženého spuštění. Okamžitá návratová hodnota je objekt, který ukládá všechny informace potřebné k provedení akce. Dotaz reprezentovaný touto metodou není proveden, dokud objekt není uveden buď voláním metody GetEnumerator přímo, nebo pomocí příkazu foreach v jazyce Visual C# nebo For Each v Visual Basic.

Metoda DistinctBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>) vrátí neuspořádanou sekvenci, která neobsahuje žádné duplicitní hodnoty. Pokud comparer je null, výchozí porovnávání rovnosti , Defaultslouží k porovnání hodnot.

Platí pro

DistinctBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Zdroj:
DistinctBy.cs
Zdroj:
DistinctBy.cs
Zdroj:
DistinctBy.cs

Vrátí odlišné prvky ze sekvence podle zadané funkce selektoru klíče.

public static System.Collections.Generic.IAsyncEnumerable<TSource> DistinctBy<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member DistinctBy : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function DistinctBy(Of TSource, TKey) (source As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TSource)

Parametry typu

TSource

Typ prvků .source

TKey

Typ klíče k rozlišení prvků.

Parametry

source
IAsyncEnumerable<TSource>

Sekvence pro odebrání duplicitních prvků.

keySelector
Func<TSource,TKey>

Funkce, která extrahuje klíč pro každý prvek.

comparer
IEqualityComparer<TKey>

Porovnávat IEqualityComparer<T> klíče.

Návraty

IAsyncEnumerable<TSource>

Obsahuje IAsyncEnumerable<T> odlišné prvky ze zdrojové sekvence.

Výjimky

keySelector je null.

Poznámky

Tato metoda se implementuje pomocí odloženého spuštění. Okamžitá návratová hodnota je objekt, který ukládá všechny informace potřebné k provedení akce. Dotaz reprezentovaný touto metodou není proveden, dokud objekt není uveden buď voláním metody GetEnumerator přímo, nebo pomocí příkazu foreach v jazyce Visual C# nebo For Each v Visual Basic.

Metoda DistinctBy<TSource,TKey>(IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>) vrátí neuspořádanou sekvenci, která neobsahuje žádné duplicitní hodnoty. Pokud comparer je null, výchozí porovnávání rovnosti , Defaultslouží k porovnání hodnot.

Platí pro