Public feed #893478

Untitled

public text v1 · immutable
Raw Edit
·published 2008-02-06 04:07 UTC
rendered paste body
/*
 * Created by SharpDevelop.
 * User: matty
 * Date: 6/02/2008
 * Time: 2:29 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
namespace ClosureFun
{
	class Program
	{
		public delegate void Func();
		public static void Main(string[] args)
		{
			Console.WriteLine("Hello World!");
			
			// TODO: Implement Functionality Here
			
			List<Func> list = new List<Func>();
			
			FunLoop(0,list);
			
			foreach(Func f in list)
			{
				f();
			}
		}
		
		public static void FunLoop(int i,List<Func> list)
		{
			if(i > 100) return;
			Func foo = delegate()
			{
				Console.WriteLine(i.ToString());
			};
			list.Add(foo);
			FunLoop(i+1,list);
		}
	}
}