Extensions to Integer

Times

Times repeats an action or functor the specified amount of times.

So, If u want to call five times to Writeline you should do

5.Times( () => Console.Out.Writeline() )

Syntax for actions

static void Times(Action  action);

Calls the action the amount of times specified

Syntax for actions using the current index:

static void Times(Action<int> action);

Calls the action passing the index each time (i.e: action(0), action(1), … etc)

Syntax for functor

static IEnumerable<T> Times<T>(Func<T> functor);

Calls the functor each time and returns the collection with each result.

Syntax for functor using the current index

static IEnumerable<T> Times<T>(Func<int, T> functor);

Calls the functor each time and returns the collection with each result