Framework Queryable Extensions. For Each Async<T>(IQueryable<T>, Action<T>, CancellationToken) Method
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.
Asynchronously enumerates the query results and performs the specified action on each element.
public static System.Threading.Tasks.Task ForEachAsync<T> (this System.Linq.IQueryable<T> source, Action<T> action, System.Threading.CancellationToken cancellationToken = default);
static member ForEachAsync : System.Linq.IQueryable<'T> * Action<'T> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()> Public Function ForEachAsync(Of T) (source As IQueryable(Of T), action As Action(Of T), Optional cancellationToken As CancellationToken = Nothing) As Task
The type of the elements of
The action to perform on each element.
A CancellationToken to observe while waiting for the task to complete.
A task that represents the asynchronous operation.
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.
See Querying data with EF Core for more information.
Submit and view feedback for