Difficulty: Easy
Correct Answer: 1, 3 and 5 only
Explanation:
Introduction / Context:C# delegates are type-safe function pointers. The compiler generates a sealed class behind the scenes for each delegate type. Understanding this generation helps reason about compatibility and invocation.
Given Data / Assumptions:
Concept / Approach:Declaring a delegate produces a class with the same name that derives from MulticastDelegate. Methods assigned to that delegate must be signature-compatible (parameter list and return type). Delegates can reference static or instance methods. The generated delegate type exposes a constructor that takes the target (object for instance methods or null for static) and a method pointer, and it provides an Invoke method matching the delegate signature.
Step-by-Step Solution:
1) True — a compiler-generated class named del appears.2) False — signatures must be compatible to assign/subscribe.3) True — all C# delegate types derive from MulticastDelegate.4) False — both static and instance methods can be targets.5) True — the delegate exposes a specific constructor and an Invoke method.Verification / Alternative check:Use reflection at runtime (typeof(del)) to see its BaseType (MulticastDelegate) and methods (Invoke, BeginInvoke/EndInvoke in older patterns).
Why Other Options Are Wrong:
Common Pitfalls:Assuming any method can be assigned to a delegate regardless of signature; in C#, type safety is enforced.
Final Answer:1, 3 and 5 only
Discussion & Comments