Example #1
0
        /// <summary>
        /// Loop for the given number of iterations while calling
        /// the given delegate with the current iteration as parameter.
        /// </summary>
        /// <param name="Loops">The number of iterations.</param>
        /// <param name="Do">A delegate to call.</param>
        public static void Loop(this Int32 Loops, Action_Int32 Do)
        {
            if (Do == null)
            {
                throw new ArgumentNullException("Do", "The parameter 'Do' must not be null!");
            }

            for (var i = 0; i < Loops; i++)
            {
                Do(i);
            }
        }
Example #2
0
        /// <summary>
        /// Loop for the given number of iterations while calling
        /// the given delegate with the current iteration as parameter.
        /// </summary>
        /// <param name="Loops">The number of iterations.</param>
        /// <param name="Do">A delegate to call.</param>
        public static void Loop(this Int32 Loops, Action_Int32 Do)
        {
            if (Do == null)
                throw new ArgumentNullException("Do", "The parameter 'Do' must not be null!");

            for (var i = 0; i < Loops; i++)
                Do(i);
        }