C#.NET delegates — Which statement is incorrect about a delegate?

Difficulty: Easy

Correct Answer: Delegate is a value type.

Explanation:


Introduction / Context:
C# delegates are central to events, callbacks, and LINQ expression trees. This question asks you to identify a false statement regarding delegate characteristics.



Given Data / Assumptions:

  • Delegates can be multicast.
  • Type safety requires signature compatibility.
  • Delegates are reference types generated by the compiler.


Concept / Approach:
Delegates are sealed reference types deriving from MulticastDelegate. They are not value types. Multicast invocation lists allow one delegate instance to call multiple compatible methods. Type safety demands that the target method’s parameter and return types match the delegate declaration.



Step-by-Step Solution:

Check each option against delegate semantics.A: True (multicast delegates).B: “Shared” commonly means reusable instances—possible; nothing forbids reuse.C: False — delegates are reference types.D: True — they wrap function pointers with type safety.E: True — signatures must match.


Verification / Alternative check:
Reflect on typeof(Action) to see BaseType = MulticastDelegate and reference-type behavior.



Why Other Options Are Wrong:
They accurately describe real delegate features in C#.



Common Pitfalls:
Confusing structs (value types) with delegates, which are classes.



Final Answer:
Delegate is a value type.

More Questions from Delegates

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion