It seems to me that Events are .NET manipulation on CLR. That is, there is no 'Event' concept nor command in IL, and the programming languages (such as C#) make use of delegates to achieve the behavior of events (which are just objects), in a way that from the CLR point of view there are no events, just a regular delegates mechanism. Is this true, or the CLR DOES have some special treatment for events?
The CLR certainly has awareness of events. They are present in the metadata of an assembly, the Reflection support built into the CLR exposes them. Its debugger interfaces expose event information to the debugger. The mapping of events declared in a [ComVisible] C# declaration to COM event sink interfaces is taken care of by the CLR Interop support built into the CLR.
But that perhaps can all be considered just infrastructure support. Turtles all the way down, the CLR isn't involved with subscribing and firing events directly, just the delegate. That's important, it needs to be fast. Otherwise core behavior of the CLR, it only ever gets involved when absolutely necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With