Delegate Instances
Although delegate types provide a type-safe way to refer to methods, instances concretize this notion by referring to a particular method (optionally) on some object. In our running example, we give a first example of instantiating a delegate instance:
This is one possible way to create a delegate instance that has been supported since the early C# 1.0 days. As shown in Figure 17.6, Visual Studio hints at the required method signature for the delegate target.
Figure 17.6. IntelliSense for instantiation of a delegate type.
Get C# 4.0 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.