QueryableExtensions.ToListAsync Method (IQueryable)

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Creates a List<T> from an IQueryable by enumerating it asynchronously.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

Syntax

'Declaration
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
<ExtensionAttribute> _
Public Shared Function ToListAsync ( _
    source As IQueryable _
) As Task(Of List(Of Object))
'Usage
Dim source As IQueryable 
Dim returnValue As Task(Of List(Of Object))

returnValue = source.ToListAsync()
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<List<Object>> ToListAsync(
    this IQueryable source
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
[ExtensionAttribute]
public:
static Task<List<Object^>^>^ ToListAsync(
    IQueryable^ source
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
static member ToListAsync : 
        source:IQueryable -> Task<List<Object>> 
public static function ToListAsync(
    source : IQueryable
) : Task<List<Object>>

Parameters

Return Value

Type: System.Threading.Tasks.Task<List<Object>>
A task that represents the asynchronous operation. The task result contains a List<T> that contains elements from the input sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IQueryable. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.113) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.113).

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 Also

Reference

QueryableExtensions Class

ToListAsync Overload

System.Data.Entity Namespace