AsyncEnumerable.ToHashSetAsync<TSource> Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Tworzy HashSet<T> na podstawie 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))
Parametry typu
- TSource
Typ elementów elementu source.
Parametry
- source
- IAsyncEnumerable<TSource>
Element IEnumerable<T> do utworzenia HashSet<T> elementu na podstawie.
- comparer
- IEqualityComparer<TSource>
Element IEqualityComparer<T> do porównywania kluczy.
- cancellationToken
- CancellationToken
Element CancellationToken do monitorowania żądań anulowania. Wartość domyślna to None.
Zwraca
Element HashSet<T> zawierający wartości typu TSource wybranego z sekwencji danych wejściowych.
Wyjątki
Parametr source ma wartość null.