/*******************Main*******************/ static void Main(string[] args) { MessagePrintDelegate mpd2 = delegate(string msg) { Console.WriteLine("[Anonymous] {0}", msg); }; LongRunningMethod(mpd2); }/*--------------End Of Main--------------*/
static void LongRunningMethod(MessagePrintDelegate mpd) { for (int i = 0; i < 99; i++) { if (i % 25 == 0) { mpd(string.Format("Progress Made. {0}% complete.", i)); } } }
static void Main(string[] args) { string source = "Outer"; MessagePrintDelegate mpd3 = delegate(string msg) { Console.WriteLine("[{0}] {1}", source, msg); }; LongRunningMethod(mpd3); }
static void Main(string[] args) { MessagePrintDelegate mpd = new MessagePrintDelegate(PrintMessage); LongRunningMethod(mpd); }