Multicasting Delegates

All instances of Delegate are MulticastDelegates, a subclass of the Delegate class. Specifically, multicasting refers to a delegate having more than one procedure address in its invocation list.

When you define multiple event handlers for a single event, when the event occurs, each event handler is called. (This behavior is probably implemented internally by iterating through the invocation list—accessible by the method GetInvocationList—and calling each method in the list, passing the required arguments. Suppose you have a Button control named Button1. Defining two methods with the Handles Button1.Click clause would cause the Button1.Click event to multicast the event to both methods with the Handles Button1.Click clause. ...

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.