public static Task<bool> ForAsync<T>(
T operation,
int fromInclusive,
int toExclusive,
TaskConfig? asyncConfig,
Action<int> body
)
Public Shared Function ForAsync(Of T) (
operation As T,
fromInclusive As Integer,
toExclusive As Integer,
asyncConfig As TaskConfig,
body As Action(Of Integer)
) As Task(Of Boolean)public:
generic<typename T>
static Task<bool>^ ForAsync(
T operation,
int fromInclusive,
int toExclusive,
TaskConfig^ asyncConfig,
Action<int>^ body
)static member ForAsync :
operation : 'T *
fromInclusive : int *
toExclusive : int *
asyncConfig : TaskConfig *
body : Action<int> -> Task<bool> If fromInclusive is greater than or equal to toExclusive, then the operation completes synchronously without performing any iterations.
If operation is not , Progress is set in asyncConfig and there is at least one iteration, then the IAsyncProgress.New method will be called before the first iteration passing the specified operation to the operationType parameter. It will be followed by as many IAsyncProgress.Increment calls as many iterations were completed successfully.
This method is not a blocking call even if the MaxDegreeOfParallelism property of the asyncConfig parameter is 1.
| ArgumentNullException | body is . |
| TaskCanceledException | The operation has been canceled and ThrowIfCanceled in asyncConfig was . This exception is thrown when the result is awaited. |