When subscribing to events in .NET do I need to create a new instance of the delegate such as
toolbarControl1.OnUploadEventHandler +=
new ToolbarControl.UploadEventHandler(toolbarControl1_OnUpload);
Or is it better to do the following?
toolbarControl1.OnUploadEventHandler += toolbarControl1_OnUpload;
Thanks in advance.
The second one takes less coding and both mean the same.
You might want to consider using generic version of EventHandler –
EventHandler<TEventArgs>. You will save on declaring all those delegates.You can also use lambda expressions, ie.