visual basic reflection:迭代给定Type的所有方法和属性

时间:2015-01-02 16:06:37

标签: vb.net reflection interface

我正在使用一个库interop.RobotOM,现在我想列出所有类及其相应的方法和成员

例如对于RobotApplication类我正在尝试以下代码:

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


但我得到以下输出:

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


这不是我所期望的,例如缺少项目和版本的属性。我想看看以下方法和属性:

link to object browser screenshot

我做错了什么?

0 个答案:

没有答案