// 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 DE { public delegate void CallEventHandler(object sender, EventArgs e); public class Demo { public event CallEventHandler StartCall; public event CallEventHandler EndCall; public void Test() { StartCall(this, EventArgs.Empty); Console.WriteLine("Testing"); EndCall(this, EventArgs.Empty); } } public class TestClass { public static void Started(object sender, EventArgs e) { Console.WriteLine("Started"); } public static void Ended(object sender, EventArgs e) { Console.WriteLine("Ended"); } public static void Main(string[] args) { Demo o = new Demo(); o.StartCall += new CallEventHandler(Started); o.EndCall += new CallEventHandler(Ended); o.Test(); } } }