Managed Templates

Class templates allow you to define a type and create one or more instantiations of the type using different type parameters. For more information on standard C++ class templates, see Class Templates.

You can also create class templates from value or reference types. See Classes and Structs (Managed) for more information about creating value or reference types. However, there are some limitations to creating class templates from managed types:

It is possible to instantiate a generic type with a managed type template parameter, but you cannot instantiate a managed template with a generic type template parameter. This is because generic types are resolved at runtime. (For more information, see Generics and Templates.)

You cannot access templates defined in a referenced assembly with C++ language syntax, but can use reflection. If a template is not instantiated, it’s not emitted in the metadata. If a template is instantiated, only referenced member functions will appear in metadata.