QueryableExtensions.ToListAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ToListAsync(IQueryable) |
Creates a List<T> from an IQueryable by enumerating it asynchronously. |
ToListAsync(IQueryable, CancellationToken) |
Creates a List<T> from an IQueryable by enumerating it asynchronously. |
ToListAsync<TSource>(IQueryable<TSource>) |
Creates a List<T> from an IQueryable<T> by enumerating it asynchronously. |
ToListAsync<TSource>(IQueryable<TSource>, CancellationToken) |
Creates a List<T> from an IQueryable<T> by enumerating it asynchronously. |
ToListAsync(IQueryable)
Creates a List<T> from an IQueryable by enumerating it asynchronously.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<System.Collections.Generic.List<object>> ToListAsync (this System.Linq.IQueryable source);
static member ToListAsync : System.Linq.IQueryable -> System.Threading.Tasks.Task<System.Collections.Generic.List<obj>>
<Extension()>
Public Function ToListAsync (source As IQueryable) As Task(Of List(Of Object))
Parameters
- source
- IQueryable
An IQueryable to create a List<T> from.
Returns
A task that represents the asynchronous operation. The task result contains a List<T> that contains elements from the input sequence.
- Attributes
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.
Applies to
ToListAsync(IQueryable, CancellationToken)
Creates a List<T> from an IQueryable by enumerating it asynchronously.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<System.Collections.Generic.List<object>> ToListAsync (this System.Linq.IQueryable source, System.Threading.CancellationToken cancellationToken);
static member ToListAsync : System.Linq.IQueryable * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.List<obj>>
Parameters
- source
- IQueryable
An IQueryable to create a List<T> from.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
A task that represents the asynchronous operation. The task result contains a List<T> that contains elements from the input sequence.
- Attributes
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.
Applies to
ToListAsync<TSource>(IQueryable<TSource>)
Creates a List<T> from an IQueryable<T> by enumerating it asynchronously.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<System.Collections.Generic.List<TSource>> ToListAsync<TSource> (this System.Linq.IQueryable<TSource> source);
static member ToListAsync : System.Linq.IQueryable<'Source> -> System.Threading.Tasks.Task<System.Collections.Generic.List<'Source>>
<Extension()>
Public Function ToListAsync(Of TSource) (source As IQueryable(Of TSource)) As Task(Of List(Of TSource))
Type Parameters
- TSource
The type of the elements of source
.
Parameters
- source
- IQueryable<TSource>
An IQueryable<T> to create a List<T> from.
Returns
A task that represents the asynchronous operation. The task result contains a List<T> that contains elements from the input sequence.
- Attributes
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.
Applies to
ToListAsync<TSource>(IQueryable<TSource>, CancellationToken)
Creates a List<T> from an IQueryable<T> by enumerating it asynchronously.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<System.Collections.Generic.List<TSource>> ToListAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Threading.CancellationToken cancellationToken);
static member ToListAsync : System.Linq.IQueryable<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.List<'Source>>
Type Parameters
- TSource
The type of the elements of source
.
Parameters
- source
- IQueryable<TSource>
An IQueryable<T> to create a list from.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
A task that represents the asynchronous operation. The task result contains a List<T> that contains elements from the input sequence.
- Attributes
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.
Applies to
Entity Framework