Repeat Action - CSharp System

CSharp examples for System:Array Element

Description

Repeat Action

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from www .j a  v  a  2  s.  co m*/

public class Main{
        public static void Repeat(this int times, Action<int> func)
      {
         for (int i = 0; i < times; ++i)
         {
            func(i);
         }
      }
        public static void Repeat(this int times, Action func)
        {
            for (int i = 0; i < times; ++i)
            {
                func();
            }
        }
}

Related Tutorials