AsyncEnumerable.ToHashSetAsync<TSource> Метод

Определение

Создает HashSet<T> из 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))

Параметры типа

TSource

Тип элементов source.

Параметры

source
IAsyncEnumerable<TSource>

Объект IEnumerable<T> для создания из HashSet<T> .

comparer
IEqualityComparer<TSource>

Сравнение IEqualityComparer<T> ключей.

cancellationToken
CancellationToken

Мониторинг CancellationToken запросов на отмену. Значение по умолчанию — None.

Возвращаемое значение

ValueTask<HashSet<TSource>>

Значение HashSet<T> , содержащее значения типа TSource , выбранного из входной последовательности.

Исключения

source равно null.

Применяется к