Managed Extensions for C++ Reference
Visual Studio .NET 2003
Managed Extensions for C++ include the following reference material:
Keywords
The following keywords implement various features of Managed Extensions for C++.
Note All code examples must be compiled using the /clr compiler option.
| Keyword | Description |
|---|---|
| __abstract | Declares a class that cannot be instantiated directly. |
| __box | Creates a copy of a __value class on the common language runtime heap. |
| __delegate | Declares a reference to a unique method (a function pointer) of a managed class. |
| __event | Declares an event method of a managed class. |
| __finally | Declares a finally block associated with a try block. |
| __gc | Declares a gc type. |
| __identifier | Enables the use of a C++ keyword as an identifier. |
| __interface | Declares an interface. |
| __nogc | Declares a native C++ class that is not garbage-collected. |
| __pin | Prevents an object or embedded object of a managed class from being moved by the common language runtime during garbage collection. |
| __property | Declares a property member for a managed class. |
| public, protected, and private | Determines the accessibility of specified types and methods outside of an assembly. |
| __sealed | Prevents a __gc class from being a base class, or a method from being overridden by one in a derived class. |
| __try_cast | Performs the specified cast or throws an exception if the cast fails. |
| __typeof | Returns the System::Type of a given type. |
| __value | Declares a value type. |
Attributes
| Attribute | Description |
|---|---|
| attribute | Creates a user-defined attribute. |
Pragmas
| Pragma | Description |
|---|---|
| managed, unmanaged | Determines if code is compiled to MSIL or unmanaged code. |
Preprocessor Directives
| Directive | Description |
|---|---|
| #using | Imports metadata into a managed application. For more information, see 21.4 Importing Metadata with #using or 21.5 Metadata as Binary Headers in the Managed Extensions specification. |
Compiler Options
| Option | Description |
|---|---|
| /AI | Specifies a directory to search to resolve file references passed to the #using directive. |
| /clr | Compiles C++ and Managed Extensions for C++ source code to MSIL. |
| /FU | Forces the use of a file name, as if it had been passed to the #using directive. |
Linker Options
| Option | Description |
|---|---|
| /ASSEMBLYMODULE | Adds a MSIL module to the assembly of a project. |
| /ASSEMBLYRESOURCE | Adds a link to a managed resource from a project. |
| /NOASSEMBLY | Creates a MSIL module that is not an assembly by itself, but can be part of an assembly |
See Also
Managed Extensions for C++ Programming | Global Attributes and Managed Extensions for C++ | DUMPBIN | CLRHEADER | C++ Keywords | Introduction to the .NET Framework Class Library