c# - Export generic code (List<T>)to COM -


this question has answer here:

com doesn't support generics?what best way replicate list<t> it's com visible in tlh file. edit:: c#::

[comvisible(true)]     [interfacetype(cominterfacetype.interfaceisiunknown)]     [guid("fa677671-5e26-4307-ad2b-19bf1e7aff8b")]     public interface ievents     {         ievents[] createlisteners();     } 

in c++ have,

ccomsafearray<csharp::ievents> ppsa;     pinterface->createlisteners(ppsa->getsafearrayptr()); 

my question should in create instance function asto replicate statement list evt=new list(); in managed c#?

correct, generic types not supported:

the com model not support concept of generic types. consequently, generic types cannot used directly com interop.

http://msdn.microsoft.com/en-us/library/ms229590.aspx

perhaps place start:

c# exposing class com - generic collections


Comments