More About Delegates

Our threading example illustrated using a delegate of type ThreadStart. We pass such a delegate to the constructor of the Thread class. When we call the Start method of the thread, the callback function that is wrapped by the delegate will be called.

A powerful feature of delegates is that you can combine them. Delegates can be multicast, in which they have an invocation list of methods. When such a delegate is called, all the methods on the invocation list will be called in turn. The Delegate.Combine method can be used to combine the invocation methods of two delegate objects, and Delegate.Remove can be used to remove methods.[4]

[4] In C# you can use the overloaded + and – operators to combine and remove delegate methods. ...

Get Programming PERL in the .NET Environment 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.