While browsing the C# Language Specification 5.0 I became aware that you can define an extern event
. I'm used to extern methods for platform invoke, and native callbacks. I have not run across this concept in my eleven years in the .NET world.
- What does an
extern
event interoperate with? - Does it provide the ability to subscribe to some native event?
- Can you raise such an event?
- What problems does it solve that earned its place in the C# language?
I searched the specs for 'extern' and discovered that properties, indexers, constructors, static constructors, finalizers (!) and even operators (!) can all be extern
. Fields can't. (I also learned that a namespace alias can be 'extern', but it means something quite different.)
Edit: That clarifies things. So extern
applies not to the event concept or property concept but to the constituent methods. Is that correct? Are COM events any different than DllImport
events?