Explicitly declares a class, structure, or interface to be unmanaged.
__nogc class-specifier __nogc struct-specifier __nogc interface-specifier
An unmanaged class is a C++ language extension that simplifies NGWS programming by providing features such as interoperability and garbage collection.
Note The __nogc keyword can also be applied to array and pointer types.
In the following example, an unmanaged class is declared (X
) and an object is instantiated and modified:
#using <mscorlib.dll> #using namespace System; __nogc class X { public: int i; }; void main() { X* x; // declares an unmanaged pointer of type X x = new X(); // creates a unmanaged object of type X x->i = 4; // modifies the unmanaged object referred to // by the unmanaged pointer x. delete x; }
Managed Extensions for C++ Keywords | C++ Keywords | __gc