AsyncEnumerable.ToHashSetAsync<TSource> Methode

Definition

Erstellt eine HashSet<T> aus einem IAsyncEnumerable<T>.

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

Typparameter

TSource

Der Typ der Elemente von source.

Parameter

source
IAsyncEnumerable<TSource>

Ein IEnumerable<T> , aus dem ein Element HashSet<T> erstellt werden soll.

comparer
IEqualityComparer<TSource>

Eine IEqualityComparer<T> zum Vergleichen von Schlüsseln.

cancellationToken
CancellationToken

Der CancellationToken zu überwachende Monitor für Abbruchanforderungen. Der Standardwert lautet None.

Gibt zurück

ValueTask<HashSet<TSource>>

Ein HashSet<T> Wert, der Werte vom Typ TSource enthält, die aus der Eingabesequenz ausgewählt sind.

Ausnahmen

source ist null.

Gilt für: