Unknown new VS.NET 2005 feature – Calling Delegate.Invoke directly

So, at the GNET2 last week, I found out that you can now call Delegate.Invoke instead of using the C# functor syntax.  This makes code much more readable IMO —

delegate void MyCallback(string msg);

MyCallback callback;

callback += delegate(string msg) { Console.WriteLine(msg); };

callback.Invoke(“Hello”);   // instead of callback(“Hello”);

Very nice.

About Mark Smith

Windows systems developer with low-level operating system, threading and .NET experience. For the past several years I have been involved with WPF/Silverlight and most recently iOS and Android. I have worked as an architect and designer for several companies and am particularly interested in client/server and graphical solutions. Specialties:.NET, WPF, Silverlight, Windows, iOS