I'm doing a program and I want to do a Reflection, but for this, I need an Object of the Type class, right? to use the .GetProperties() method... So I tryed this:
Type typeName = simObjects.getType();
But the .GetType() is returning "System.__COMObject". And this is not helpfull. The same happens with .typeof(). I search and found another code, this one:
Type typeName = (Type)Microsoft.VisualBasic.Information.TypeName(simObjects);
But this method return a String, and I need it in System.Type, Can any genious please help me?
See this link on how to get the type:
http://support.microsoft.com/kb/320523
See this SO answer regarding COM objects and reflection:
https://stackoverflow.com/a/10617479/4004002
Also, do you know what the properties are ahead of time? If so you may (I've never tried it with a COM object) be able to use Dynamics instead to access the properties.
EDIT: This link explains using dynamics and COM
http://msdn.microsoft.com/en-us/magazine/ff714583.aspx
In case it disappears:
Well, i know its a late answear, i solve my problem some time ago, i'll answear, hope it can help someone.
I did not use reflextion as i wish, but its working pretty fine.
This code return the name of the attributes, for example, imagine that my COMObject have this attributes:
and Son have:
in the first loop, the descrip.Name will be "age", "name" and "Phill", and in the second (supose that the condiiton return true with "Son"), "age" and "name".
Hope this helps someone.