vendredi 2 janvier 2015

visual basic reflection: iterate all methods and properties for given Type

I am using a library interop.RobotOM, and now i want to list all its classes with their corresponding methods and members


for example for the class RobotApplication I'm trying the following code:



Dim myObject As IRobotApplication
myObject = New RobotApplication

For Each prop In myObject.GetType.GetProperties()
Debug.Print(prop.Name & " " & prop.PropertyType.ToString())
Next

For Each method In myObject.GetType.GetMethods()
Debug.Print(method .Name & " " & method .ReturnType.ToString())
Next




but i get the following output:



ToString System.String
GetLifetimeService System.Object
InitializeLifetimeService System.Object
CreateObjRef System.Runtime.Remoting.ObjRef
Equals System.Boolean
GetHashCode System.Int32
GetType System.Type




this is not what i expected, for example the properties Project and version are missing. I want to see following methods and properties:


link to object browser screenshot


what am I doing wrong ?






Aucun commentaire:

Enregistrer un commentaire