ParallelHelperFor(Int32, Int32, ParallelConfig, ActionInt32) Method

Executes an indexed loop synchronously, in which iterations may run in parallel and the execution can be configured.
See the Remarks section of the ForT(T, Int32, Int32, ParallelConfig, ActionInt32) overload for details.

Definition

Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public static bool For(
	int fromInclusive,
	int toExclusive,
	ParallelConfig? configuration,
	Action<int> body
)

Parameters

fromInclusive  Int32
The start index, inclusive.
toExclusive  Int32
The end index, exclusive.
configuration  ParallelConfig
An optional configuration to adjust parallelization or cancellation. This method does not report progress even if Progress is set in this parameter. To report progress use the ForT(T, Int32, Int32, ParallelConfig, ActionInt32) overload.
body  ActionInt32
The delegate that is invoked once per iteration.

Return Value

Boolean
, if the operation completed successfully.
, if the operation has been canceled and ThrowIfCanceled in configuration was set to .

Exceptions

ArgumentNullExceptionbody is .
OperationCanceledExceptionThe operation has been canceled and ThrowIfCanceled in configuration was .

See Also