Exemplo n.º 1
0
        /// <summary>
        /// Performs an action of each element in an array
        /// </summary>
        /// <remarks>Credits to Alex Burtsev @ StackOverflow</remarks>
        /// <seealso cref="https://github.com/Burtsev-Alexey/net-object-deep-copy"/>
        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());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs an action of each element in an array
        /// </summary>
        /// <remarks>Credits to Alex Burtsev @ StackOverflow</remarks>
        /// <seealso cref="https://github.com/Burtsev-Alexey/net-object-deep-copy"/>
        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());
        }