Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.