.NET Fiddle

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public delegate void MyDelegate (MyDelegate x, int y);
	
	public static void Foo(MyDelegate x, int y)
	{
		Console.WriteLine(y);
		
		if (y == 0)
			return;
		
		x(x, y - 1);
	}
	
	public static void Main()
	{
		Foo(Foo, 10);
	}
}
;