Junior — Middle
What specific data type is used to implement delegates in the programming language?
sobes.tech AI
Answer from AI
In C#, delegates are implemented as objects of type System.Delegate or more specifically System.MulticastDelegate.
These are special types that encapsulate references to methods with a specific signature. When declaring a delegate, the compiler creates a class inheriting from MulticastDelegate.
Example of declaring a delegate:
delegate void MyDelegate(string message);
Internally, MyDelegate is a class derived from MulticastDelegate that stores method references and allows invoking them through delegate objects.