Complete the code to declare a delegate named Callback that takes no parameters and returns void.
public delegate [1] Callback();The delegate must return void because it represents a callback with no return value.
Complete the code to declare a method named Process that accepts a Callback delegate as a parameter.
public void Process([1] callback) { callback(); }The method parameter must be of type Callback to accept the delegate.
Fix the error in the code by completing the delegate invocation inside the Process method.
public void Process(Callback callback) { callback[1]; }Delegates are invoked like methods, so parentheses () are needed to call the delegate.
Fill both blanks to create a dictionary comprehension that maps strings to their lengths only if length is greater than 3.
var lengths = new Dictionary<string, int> { { [1], [2] } };This task is a trick question to check understanding of dictionary initialization syntax. The correct answer is to fill the blanks with key and value strings.
Fill all three blanks to define and use a delegate as a callback that prints a message.
public delegate void [1](); public void Run([2] callback) { callback[3]; }
The delegate is named Callback, the parameter type is Callback, and the delegate is invoked with parentheses ().