Vb.net VisualBasic反射:迭代给定类型的所有方法和属性

Vb.net VisualBasic反射:迭代给定类型的所有方法和属性,vb.net,reflection,interface,Vb.net,Reflection,Interface,我正在使用一个库interop.robotm,现在我想列出它的所有类及其相应的方法和成员 例如,对于RobotApplication类,我正在尝试以下代码: Dim myObject As IRobotApplication myObject = New RobotApplication For Each prop In myObject.GetType.GetProperties() Debug.Print(prop.Name & " " & prop.Propert

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

例如,对于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

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


我做错了什么?

尝试将
System.Reflection.BindingFlags.Instance
添加到
.GetProperties()
调用中。有关详细信息,请参阅此答案:。thx用于答复,但添加BindingFlags.Instance无效。我还尝试通过名称[myObject.GetType.GetProperty(“Version”,BindingFlags.Instance)]获取属性,但我得到了一个NullReferenceException(未找到de属性“Version”,但正如您在屏幕截图中看到的,它确实存在…)