What is the difference between delegates and interfaces in C#?
A. Delegates define a contract for classes to implement methods, whereas interfaces provide a way to reference methods
B. Delegates can encapsulate methods with different signatures, whereas interfaces define methods with specific signatures
C. Delegates cannot be used with events, whereas interfaces can
D. Delegates provide a way to reference methods, whereas interfaces define a contract for classes to implement methods
Answer: Option D
What is the purpose of the GetInvocationList() method associated with delegates in C#?
A. Removes a delegate from the current delegate
B. Adds a new delegate to the current delegate
C. Invokes all the delegates bound to the current delegate
D. Retrieves an array of delegates bound to the current delegate
What is a callback function in the context of delegates and events in C#?
A. A function that is called when an event is raised
B. A function that is called to subscribe to an event
C. A function that is called to unsubscribe from an event
D. A function that is called to handle an event
A. Func
B. Predicate
C. Action
D. EventHandler

Join The Discussion