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

C# Programming Delegates Difficulty: Easy
Choose an option
  • A
    A single delegate can invoke more than one method.
  • B
    Delegates can be shared.
  • C
    Delegate is a value type.
  • D
    Delegates are type-safe wrappers for function pointers.
  • E
    The signature of a delegate must match the signature of the method that is to be called using it.

Answer

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.

Discussion & Comments
No comments yet. Be the first to comment!
More Questions from Delegates
Join Discussion