Complete the code to declare a delegate named MyDelegate that takes no parameters and returns void.
public delegate [1] MyDelegate();The delegate must specify the return type. Here, it returns nothing, so void is correct.
Complete the code to create an instance of the delegate MyDelegate that points to the method ShowMessage.
MyDelegate del = new MyDelegate([1]);When assigning a method to a delegate, use the method name without parentheses.
Fix the error in the delegate invocation by completing the code to call the delegate instance del.
del[1];To invoke a delegate, use parentheses like calling a method.
Fill both blanks to declare a delegate that takes an int parameter and returns a string.
public delegate [1] MyDelegate([2] number);
The delegate returns a string and takes an int parameter named number.
Fill all three blanks to create a delegate instance that points to the method GetMessage and invoke it.
MyDelegate del = new [1]([2]); string result = del[3];
Create the delegate instance with the delegate type and method name, then invoke it with parentheses.