Al Heck

What is a Delegate

A delegate is a variable that holds 1 or several methods. You create a variable that declares the method.

We can also pass in parameters to these delegates.

If you want to use functions to these delegates, you have to make sure the function matches via signature. Here are examples.

To use these functions, we need to connect the variables to the function called. Now when you run onColorChange, it runs the function UpdateColor which has parameters declared in ChangeColor. When you run onComplete, it runs the function task.

How to invoke? Call the variable.

Delegates are also multicast, where we can use a handful of methods applied to them. Before invoking, you want to check if it’s not null as well.