For Each element in array do action - CSharp System

CSharp examples for System:Array Element

Description

For Each element in array do action

Demo Code


using System;/*from  w  w  w  .ja v a2 s. com*/

public class Main{
        public static void ForEach(this Array array, Action<Array, int[]> action)
        {
            if (array.LongLength == 0) return;
            ArrayTraverse walker = new ArrayTraverse(array);
            do action(array, walker.Position);
            while (walker.Step());
        }
}

Related Tutorials