Tip
See the Examples section of the AsyncHelper
class for details about how to create a context for possibly async top level methods.
public static bool For<T>(
IAsyncContext context,
T operation,
int fromInclusive,
int toExclusive,
Action<int> body
)
Public Shared Function For(Of T) (
context As IAsyncContext,
operation As T,
fromInclusive As Integer,
toExclusive As Integer,
body As Action(Of Integer)
) As Booleanpublic:
generic<typename T>
static bool For(
IAsyncContext^ context,
T operation,
int fromInclusive,
int toExclusive,
Action<int>^ body
)static member For :
context : IAsyncContext *
operation : 'T *
fromInclusive : int *
toExclusive : int *
body : Action<int> -> bool This method blocks the caller thread but if context belongs to an async top level method, then the execution may already run on a pool thread. Degree of parallelism, the ability of cancellation and reporting progress depend on how these were configured at the top level method. To reconfigure the degree of parallelism of an existing context, you can use the AsyncContextWrapper class.
| ArgumentNullException | body is . |