Associated with your editing. The imposition of handlers does not actually affect the use of new or not, but there is a slight difference in removing handlers like this
listView.ItemClick -= listView_ItemClick;
and
listView.ItemClick -= new ItemClickEventHandler(listView_ItemClick);
although it is unlikely to affect most scenarios. The first version, without the new keyword, is supposedly more efficient.
Detailed explanation in this post , but conclusion
So both work, but which one should we use? If events are signed / unsubscribed once at the beginning / end, as in a typical WinForm, then this does not really matter. However, if this is done several times, then the second approach is preferable, since it is less than expensive heap allocations and will work faster
(the second approach in this post is for those who don't have the new keyword)
Having said that this seems like micro-optimization for me, so this is unlikely to be a bottleneck in most cases.
keyboardP
source share