What's a global method?

Hard to talk about this at all in familiar terms, this capability is not at all exposed in the C# or VB.NET languages. The C++/CLI compiler uses it however. The way it is shown in disassemblers like Ildasm.exe or Reflector is also not standardized.

Perhaps the best angle is Reflector, take a look-see at the System.Data.dll assembly. It is in an unnamed namespace ("-" in Reflector), <Module> node. The .cctor you see there is a module initializer. Same kind of animal as a static class constructor but at the module level. It runs when the assembly gets loaded. C++/CLI uses it to initialize the C runtime library.

The ___CxxCallUnwindDtor() method you find there is an example of a "global method". The C++/CLI language doesn't give any way to make these kind of functions public, they are always embedded in the metadata with internal accessibility. And can thus not be called directly from a C# or VB.NET program. I haven't played enough with ModuleBuilder to know if that can be messed with at all beyond what C++/CLI does. This is all very obscure and not actually that useful.

Tags:

.Net