AsyncEnumerable.ToHashSetAsync<TSource> Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
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
Een HashSet<T> met waarden van het type TSource dat is geselecteerd in de invoerreeks.
Uitzonderingen
source is null.