Nevron .NET Vision
Nevron.Threading Namespace / NParallel Class / For Method
Loop's start index.
Loop's stop index.
Loop's body.


In This Topic
    For Method
    In This Topic
    Executes a for-loop in which iterations may run in parallel.
    Syntax
    'Declaration
     
    
    Public Shared Sub For( _
       ByVal start As System.Integer, _
       ByVal stop As System.Integer, _
       ByVal loopBody As NParallel.ForLoopBody _
    ) 
    'Usage
     
    
    Dim start As System.Integer
    Dim stop As System.Integer
    Dim loopBody As NParallel.ForLoopBody
     
    NParallel.For(start, stop, loopBody)
    public static void For( 
       System.int start,
       System.int stop,
       NParallel.ForLoopBody loopBody
    )

    Parameters

    start
    Loop's start index.
    stop
    Loop's stop index.
    loopBody
    Loop's body.
    Remarks

    The method is used to parallel for-loop running its iterations in different threads. The start and stop parameters define loop's starting and ending loop's indexes. The number of iterations is equal to stop - start.

    Sample usage:

    Parallel.For( 0, 20, delegate( int i ) // which is equivalent to // for ( int i = 0; i < 20; i++ ) { System.Diagnostics.Debug.WriteLine( "Iteration: " + i ); // ... } );
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also