EnumerableExt.ForEachAsync(TIn) Method (IEnumerable(TIn), Func(TIn, Task))
Asynchronously applies a function on all elements in a collection.
Namespace: UltimateXR.Extensions.System.Collections
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static Task ForEachAsync<TIn>(
this IEnumerable<TIn> list,
Func<TIn, Task> function
)
Parameters
- list
- Type: System.Collections.Generic.IEnumerable(TIn)
Elements to apply the function on - function
- Type: System.Func(TIn, Task)
Function to apply
Type Parameters
- TIn
- Element type
Return Value
Type: Task
An awaitable task wrapping the Task.WhenAll applying the function on all elements in a collection
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TIn). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also
Reference
EnumerableExt Class
ForEachAsync Overload
UltimateXR.Extensions.System.Collections Namespace