// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public delegate void Foo(); public delegate void Bar(int a); public class Anonymous { public static void M1(Foo f) { f(); } public static void M2(Foo f, Bar b) { f(); b(1); } public static void Main(string[] args) { int v1 = 1; int v2 = 2; M1(() => Console.WriteLine(v1)); M2(() => Console.WriteLine(v1), (a) => Console.WriteLine(v2 + a)); } } }