I need to implement a COM interface in VB.NET and C#.NET. The interface has
the following method:
void SetObjects([in] SAFEARRAY(LPUNKNOWN) objects);
In other words, I need to pass an array of IUnknown pointers to VB or C#.
I can change the interface however I want. My goal is to make the managed
code as simple as possible, i.e., receive an ArrayList if possible.
How should I define SetObjects in my IDL?
What is the corresponding method declaration in VB and C#?
John - COM expert, .NET newbie
Robert Jordan - 21 Oct 2005 18:12 GMT
John,
> I need to implement a COM interface in VB.NET and C#.NET. The interface has
> the following method:
[quoted text clipped - 8 lines]
> How should I define SetObjects in my IDL?
> What is the corresponding method declaration in VB and C#?
C#:
void SetObjects(
[In]
[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_UNKNOWN)]
object[] objects
);
The marshal attribute is probably not necessary.
Robert
John Lutz - 21 Oct 2005 19:06 GMT
Thanks, I had a typo in my code. Your sample helped me see it.
> John,
>
[quoted text clipped - 22 lines]
>
> Robert