Return Arrays from a C# COM object

F

fallenidol

Does anyone have and links or a brief summary of how to Return Arrays from a
C# COM object?
 
N

Nicholas Paldino [.NET/C# MVP]

fallenidol,

Well, if you are talking about just COM, then you can return a regular
pointer-based array. The runtime won't know what to do with this though,
and you will have to do some custom marshalling.

You can also use a SAFEARRAY, which the interop layer will know how to
marshal.

If you are using VB, or some Automation language, then all you have to
do is declare your return value as an array, and .NET should know how to
handle it intrinsically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top