Managed Extensions for C++ Syntax Upgrade Checklist

For Visual C++ 2005, Visual C++ includes features for targeting virtual machines with garbage collection, such as the .NET Framework. For Visual C++ 2008, support for Managed Extensions for C++ is deprecated, and might be removed entirely in a future release.

Remove #using <mscorlib.dll>. (This assembly is now referenced by default.)

Replace __gc class with ref class.

Replace __gc struct with ref struct.

Replace __value class with value class.

Replace __value struct with value struct.

Remove default constructors from value classes. (Default constructors for value types are allowed in Managed Extensions for C++, but the nature of the CLR prevents them from being called reliably, so this feature has been removed.)

Replace __sealed with sealed, and move it after the class name. For more information, see sealed.

Replace __property with property, combine the get and set methods into a single property block, and remove the trailing underbar/name suffix from these accessors. For simple properties, the accessors need not be defined explicitly. The syntax for indexed properties requires bracket pairs after the property type. For more information, see, How to: Use Simple Properties and How to: Use Indexed Properties.

Replace pointers to values types that potentially live in the garbage collected heap with interior_ptr.

Replace pointers declared with __pin with instances of pin_ptr, unless a whole object is being pinned, in which case use interior_ptr, and then use pin_ptr on the interior pointer. For Visual C++ 2005, this template is defined in the cli Namespace.

Remove the "S" prefix from string literals (the compiler now determines if a string is literal based on the context in which it is used.)

Replace the explicit declaration and usage of overloaded operators required in Managed Extensions for C++ (such as op_Addition, op_Subtraction) with the traditional C++ syntax. For more information, see User-Defined Operators and Operator Overloading.

Update conversion operators (which use op_Implicit and op_Explicit in Managed Extensions for C++ syntax.) For more information, see User-Defined Conversions.

If you were signing your assembly (also known as giving your assembly a strong name) with the CLR's assembly-signing attributes, you should remove those attributes from your code and instead use the assembly-signing linker options. For more information, see Strong Name Assemblies (Assembly Signing) (C++/CLI).