20
1
using System;
2
3
public static class IntExtensions
4
{
5
public static void Times(this int i, Action<int> func)
6
{
7
for(int j = 0; j < i; j++)
8
{
9
func(j);
10
}
11
}
12
}
13
14
public class Program
15
{
16
public static void Main()
17
{
18
5.Times(i => Console.Write("{0} ", i));
19
}
20
}
Cached Result