EntityFrameworkQueryableExtensions.ToHashSetAsync Method

Definition

Overloads

ToHashSetAsync<TSource>(IQueryable<TSource>, CancellationToken)

Asynchronously creates a HashSet<T> from an IQueryable<T> by enumerating it asynchronously.

ToHashSetAsync<TSource>(IQueryable<TSource>, IEqualityComparer<TSource>, CancellationToken)

Asynchronously creates a HashSet<T> from an IQueryable<T> by enumerating it asynchronously.

ToHashSetAsync<TSource>(IQueryable<TSource>, CancellationToken)

Source:
EntityFrameworkQueryableExtensions.cs

Asynchronously creates a HashSet<T> from an IQueryable<T> by enumerating it asynchronously.

public static System.Threading.Tasks.Task<System.Collections.Generic.HashSet<TSource>> ToHashSetAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Threading.CancellationToken cancellationToken = default);
static member ToHashSetAsync : System.Linq.IQueryable<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.HashSet<'Source>>
<Extension()>
Public Function ToHashSetAsync(Of TSource) (source As IQueryable(Of TSource), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HashSet(Of TSource))

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> to create a set from.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<HashSet<TSource>>

A task that represents the asynchronous operation. The task result contains a HashSet<T> that contains elements from the input sequence.

Exceptions

source is null.

Remarks

Multiple active operations on the same context instance are not supported. Use await to ensure that any asynchronous operations have completed before calling another method on this context. See Avoiding DbContext threading issues for more information and examples.

See Querying data with EF Core for more information and examples.

Applies to

ToHashSetAsync<TSource>(IQueryable<TSource>, IEqualityComparer<TSource>, CancellationToken)

Source:
EntityFrameworkQueryableExtensions.cs

Asynchronously creates a HashSet<T> from an IQueryable<T> by enumerating it asynchronously.

public static System.Threading.Tasks.Task<System.Collections.Generic.HashSet<TSource>> ToHashSetAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Collections.Generic.IEqualityComparer<TSource>? comparer, System.Threading.CancellationToken cancellationToken = default);
static member ToHashSetAsync : System.Linq.IQueryable<'Source> * System.Collections.Generic.IEqualityComparer<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.HashSet<'Source>>
<Extension()>
Public Function ToHashSetAsync(Of TSource) (source As IQueryable(Of TSource), comparer As IEqualityComparer(Of TSource), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HashSet(Of TSource))

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> to create a set from.

comparer
IEqualityComparer<TSource>

The IEqualityComparer<T> implementation to use when comparing values in the set, or null to use the default EqualityComparer<T> implementation for the set type.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<HashSet<TSource>>

A task that represents the asynchronous operation. The task result contains a HashSet<T> that contains elements from the input sequence.

Exceptions

source is null.

Remarks

Multiple active operations on the same context instance are not supported. Use await to ensure that any asynchronous operations have completed before calling another method on this context. See Avoiding DbContext threading issues for more information and examples.

See Querying data with EF Core for more information and examples.

Applies to