QueryableExtensions.ForEachAsync Method (IQueryable, Action<Object>)

[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.]

Asynchronously enumerates the query results and performs the specified action on each element.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function ForEachAsync ( _
    source As IQueryable, _
    action As Action(Of Object) _
) As Task
'Usage
Dim source As IQueryable 
Dim action As Action(Of Object)
Dim returnValue As Task 

returnValue = source.ForEachAsync(action)
public static Task ForEachAsync(
    this IQueryable source,
    Action<Object> action
)
[ExtensionAttribute]
public:
static Task^ ForEachAsync(
    IQueryable^ source, 
    Action<Object^>^ action
)
static member ForEachAsync : 
        source:IQueryable * 
        action:Action<Object> -> Task
public static function ForEachAsync(
    source : IQueryable, 
    action : Action<Object>
) : Task

Parameters

Return Value

Type: System.Threading.Tasks.Task
A task that represents the asynchronous operation.

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

ForEachAsync Overload

System.Data.Entity Namespace