Reflection获取.NET组件的信息
来源:岁月联盟
时间:2007-02-01
Dim assemblyInfo As System.Reflection.Assembly
assemblyInfo = assemblyInfo.LoadFrom( _
"C:/WINDOWS/Microsoft.NET/Framework/v1.0.3705/System.Data.dll")
下一步,我们将通过GetModules方法循环该组件从而获得该组件中的每一个模块,并使用GetTypes()方法来显示此程序集中定义的所有类型(或者类),还可以使用GetMethods.方法获取当前 Type 的特定方法。
Dim moduleInfo As System.Reflection.Module
Dim typeInfo As System.Type
Dim methodInfo As System.Reflection.MethodInfo
For Each moduleInfo In assemblyInfo.GetModules()
Debug.WriteLine(moduleInfo.Name)
Debug.Indent()
For Each typeInfo In moduleInfo.GetTypes()
Debug.WriteLine(typeInfo.Name)
Debug.Indent()
For Each methodInfo In typeInfo.GetMethods()
Debug.WriteLine(methodInfo.Name)
Next
Next
Next
上一篇:VB从图片框控件取得颜色
下一篇:如何轻松调整VB.NET控件