using System; public delegate void LogHandler(string s); public class Process { public event LogHandler LogEvent = null; public void Run() { if (LogEvent != null) LogEvent("Start process"); //... if (LogEvent != null) LogEvent("Stop process"); } } public class Tracer { public void Trace(string s) { System.Console.WriteLine("Tracer: {0}", s); } } public class Test { public static void Log(string s) { System.Console.WriteLine("static Log: {0}", s); } public static int Main(string[] args) { Process p = new Process(); Tracer t = new Tracer(); //... LogHandler lh = null; //... lh += new LogHandler(Log); //... lh += new LogHandler(t.Trace); //... p.LogEvent += lh; p.LogEvent += new LogHandler(Log); p.LogEvent += new LogHandler(t.Trace); p.Run(); return 0; } }