Table of Contents

Method ToHashSetAsync

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

ToHashSetAsync(IEqualityComparer<T>?, CancellationToken)

Asynchronously reads every mapped row into a new HashSet<T>.

public ValueTask<HashSet<T>> ToHashSetAsync(IEqualityComparer<T>? comparer = null, CancellationToken cancellationToken = default)

Parameters

comparer IEqualityComparer<T>

The comparer for the rows, or null to use the default comparer.

cancellationToken CancellationToken

Cancels the operation. When it cannot be canceled, the cancellation token set on the underlying command applies.

Returns

ValueTask<HashSet<T>>

A task that produces a set of the distinct rows.

Remarks

All rows are buffered in memory before the call returns. Use Read(Action<IEnumerable<T>>) to process very large results as a stream.

Exceptions

OperationCanceledException

The operation was canceled.

See Also