ParallelHelperFor(Int32, Int32, ActionInt32) Method

Executes an indexed loop synchronously, in which iterations may run in parallel.

Definition

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

Parameters

fromInclusive  Int32
The start index, inclusive.
toExclusive  Int32
The end index, exclusive.
body  ActionInt32
The delegate that is invoked once per iteration.

Remarks

This method is functionally the same as Parallel.For(int, int, Action<int>) but it can be used even in .NET Framework 3.5.

If fromInclusive is greater than or equal to toExclusive, then the method returns without performing any iterations.

This method has no return type because if there was no exception, then the loop is guaranteed to be completed.

Exceptions

See Also