How to use pointer from COM object on C#?

Posted by Jaeh on Stack Overflow See other posts from Stack Overflow or by Jaeh
Published on 2012-11-15T16:55:11Z Indexed on 2012/11/15 17:00 UTC
Read the original article Hit count: 130

Filed under:
|

All.

I'm trying to use my old dll file on .net project. So I converted this unmanaged COM object to managed one by using [tlbimp.exe] util from Windows SDK.

However, one method returns a Object as a return value, but whenever I try to use it, my program generates an error.

The weird thing is below:

//Object[] item = s.GetObjects(); //this generates an type error
Object item = s.GetObjects(); //this works okay
System.WriteLine(items); //prints System.Object[] rather than System.Object.

It seems like it returns a pointer which contains an object array. Isn't it ?
Please anyone tell me how to handle this, and is there any documentation for this issue ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET