using System; using System.Collections.Generic; using System.Text; namespace OuterVariables { class Outer { static void Main(string[] args) { Test t = new Test(); t.F(); t.d(); } } public delegate void D(); class Test { int _x = 1; public D d = null; public void F() { int y = 123; int z = y + _x; d = delegate { Console.WriteLine("{0}, {1}, {2}", _x, y, z); }; d(); } } }