18.4. Summary

C# delegates can be thought of as type-safe function pointers. Function pointers are essentially references to actual functions. A delegate can also wrap a call to a series of functions that can be added or deleted dynamically. Because of the indirect nature of the function call, delegates are useful for simulating asynchronous method calls (such as calls to the System.Threading and System.IO namespaces). Delegates are also used in event-based programming in C#. Event programming in C# is similar to the JavaBeans property change listener paradigm. Because you can add or delete functions to a delegate, which in turn points to multiple functions, delegates can conveniently simulate the JavaBeans property change listener paradigm. ...

Get .NET for Java Developers: Migrating to C# 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.