NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

__nogc

Explicitly declares a class, structure, or interface to be unmanaged.

__nogc class-specifier
__nogc struct-specifier
__nogc interface-specifier

Remarks

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.

Example

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;
}

See Also

Managed Extensions for C++ Keywords | C++ Keywords | __gc