You do not need to use the new operator. You haven't had to since C # 2.0 came out:
foo.SomeEvent += EventHandler; foo.SomeEvent -= EventHandler;
This uses method group conversion to create a delegate from a method group (method name). This applies not only to events:
Action<string> writeToConsole = Console.WriteLine;
EDIT: Regarding how this works:
- Using
-= in an event simply ends with a call to "remove" accessor, which usually uses -= for a delegate ... (at least efficiently) - Usage
-= for delegate - syntax sugar for Delegate.Remove Delegate.Remove uses delegate equality - two delegate instances are equal if they have the same method and the same target instance (e.g. methods)
Note that using method group transformations will still create a new delegate instance each time you go through the code.
source share