DbRawSqlQuery<TElement>.ToListAsync Method (CancellationToken)
[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 the query by enumerating it asynchronously.
Namespace: System.Data.Entity.Infrastructure
Assembly: EntityFramework (in EntityFramework.dll)
Syntax
'Declaration
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
Public Function ToListAsync ( _
cancellationToken As CancellationToken _
) As Task(Of List(Of TElement))
'Usage
Dim instance As DbRawSqlQuery
Dim cancellationToken As CancellationToken
Dim returnValue As Task(Of List(Of TElement))
returnValue = instance.ToListAsync(cancellationToken)
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public Task<List<TElement>> ToListAsync(
CancellationToken cancellationToken
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
public:
Task<List<TElement>^>^ ToListAsync(
CancellationToken cancellationToken
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
member ToListAsync :
cancellationToken:CancellationToken -> Task<List<'TElement>>
public function ToListAsync(
cancellationToken : CancellationToken
) : Task<List<TElement>>
Parameters
- cancellationToken
Type: System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<List<TElement>>
A task that represents the asynchronous operation. The task result contains a List<T> that contains elements from the input sequence.
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.