EnumerableExt.ForEachAsync(TIn, TOut) Method (IEnumerable(TIn), Func(TIn, Task(TOut)))
Asynchronously applies a function to 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<TOut[]> ForEachAsync<TIn, TOut>(
this IEnumerable<TIn> list,
Func<TIn, Task<TOut>> function
)
Parameters
- list
- Type: System.Collections.Generic.IEnumerable(TIn)
Elements to apply the function on - function
- Type: System.Func(TIn, Task(TOut))
Function to apply
Type Parameters
- TIn
- Element type
- TOut
- Function return type
Return Value
Type: Task(TOut[])
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