// 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; using System.Xml; namespace E { public class Program { public delegate void Foo(object o); public delegate void Bar(String o); public static void Main(string[] args) { /* Foo foo = new Foo(FooEx); foo(new XmlDocument()); // if the previous were allowed then what would happen here ?? */ Bar bar = new Bar(BarEx); bar("ABC"); // this works } public static void FooEx(String o) { Console.WriteLine(o.Substring(0, 2)); } public static void BarEx(Object o) { Console.WriteLine(o.ToString()); } } }