Reflection on COM object

N

Norbert Pürringer

Hello,

I would like to read out each property of a COM object via reflection:

comObject.GetType().GetProperties()

Instead of getting a list of properties, GetProperties returns an
array of 0 PropertyInfo objects. Is reflection only possible for
normal C# objects?

Thank you,
Norbert
 
H

Howard Swope

I'm not a pro on COM interop, but a COM object is not a .Net object. Unless
a COM object supports an IDispatch interface there won't be run time type
information. It doesn't have any notion of reflection. Calling GetType() on
a COM object will probalby just return some kind of managed wrapper
information. I don't know if it is smart enough to redirect calls to
IDispatch, but there isn't really a one to one relationship between
IDispatch and System::Type either.

....
 
M

Michael Rouen

You could try :
comObject|get-member
it will list the properties and methods of your COM Object
 

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