AsyncEnumerable.ToHashSetAsync<TSource> Methode

Definitie

Hiermee maakt u een HashSet<T> van een 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))

Type parameters

TSource

Het type van de elementen van source.

Parameters

source
IAsyncEnumerable<TSource>

Een IEnumerable<T> van waaruit u een HashSet<T> wilt maken.

comparer
IEqualityComparer<TSource>

Een IEqualityComparer<T> om sleutels te vergelijken.

cancellationToken
CancellationToken

De CancellationToken te controleren op annuleringsaanvragen. De standaardwaarde is None.

Retouren

ValueTask<HashSet<TSource>>

Een HashSet<T> met waarden van het type TSource dat is geselecteerd in de invoerreeks.

Uitzonderingen

source is null.

Van toepassing op