This documentation is archived and is not being maintained.

Interoperating Using Generic Types

The COM model does not support the concept of generic types. Consequently, generic types cannot be used directly for COM interop.

The following actions are not supported and will fail with an E_NOINTERFACE error:

  • Accessing generic interfaces from COM.

  • Accessing class interfaces for nongeneric classes that derive from generic classes.

  • Generating class interfaces for generic classes. For example, the _MyGenericType interface cannot be generated for the MyGenericType<T> class.

You can access a generic class indirectly using a nongeneric base interface. For example, consider the following type:


class MyClass <T> : IMyClass, IEnumerable<int>

COM clients can make calls to instances of this type using the IMyClass interface, but calls to either _MyClass, _MyClass <T> or IEnumerable<T> will fail.