|
|
Multivalued delegates | A delegate can contain more than one method. |
A delegate can contain an arbitrary number of methods |
Similar to class Messenger on the previous page. Allows adding and subtraction of methods to the delegate
in a Messenger object
via the methods InstallMessage and UninstallMessage. |
Identical to class A on the previous page. Just a simple class with an instance method. |
Illustrates that it is possible to add (and delete) a number of different methods (of same signature)
to a given instance of class Messenger. |
Confirms that a delegate calls all of its methods. |
Summary of delegates Delegates are types. The values of delegate types are methods With delegates, methods become first class citizens A variable of a delegate type can contain both static and instance methods A variable of a delegate type can even contain two or more methods |
Read more about multivalued delegates in the text book version of this material. |