// Example to show that C# has static, not dynamic, nested scopes, // using anonymous methods. Requires C# 2.0. 2005-02-23 using System; class Nested { public static void Main(String[] args) { m(); } static void m() { Foo f; { int y = 11; f = delegate(int x) { return x + y; }; } { int y = 22; Console.WriteLine(f(3)); } } } public delegate int Foo(int x); // int -> int