// C# のクロージャ例
Func<int> CreateClosure()
{
int i = 0;
Func<int> counter = () => ++i;
return counter;
}