Tag Info

New answers tagged

1

A common use for events is in form controls. A form control can have a lot of events, a ListView for example has 79 different events. Having to create a delegate list for every event would mean that there would be a lot of those. With just a dozen controls there would be around a thousand delegate lists to create, but most of those would end up unused and ...


1

All delegates are effectively lists. The empty list is null, but you can still append to it with +=. The need to check for null before calling is very inconvenient, yes. But does not occur because they are not lists! It occurs because of how the empty list is represented. However you can avoid this by initialising the event: public event EventType MyEvent ...



Top 50 recent answers are included