Reflection on COM object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?Q?Norbert_P=FCrringer?=

    Reflection on COM object

    Hello,

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

    comObject.GetTy pe().GetPropert ies()

    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
  • Howard Swope

    #2
    Re: Reflection on COM object

    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.

    ....

    "Norbert Pürringer" <thalion77@graf fiti.netwrote in message
    news:5fe3468f-3801-4b6c-b1a7-c3867b75f052@w3 9g2000prb.googl egroups.com...
    Hello,
    >
    I would like to read out each property of a COM object via reflection:
    >
    comObject.GetTy pe().GetPropert ies()
    >
    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

    Comment

    Working...