.NET面试题:什么是反射

2023-07-06   


所有的.NET程序集都有元数据信息,这些元数据信息可以通过一种反射的机制进行访问。System.Reflection可以用来浏览元数据信息。
   下面是使用反射的实例代码:
   Public Class Form1
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
   System.EventArgs) Handles MyBase.Load
   Dim Pobjtype As Type
   Dim PobjObject As Object
   Dim PobjButtons As New Windows.Forms.Button()
   Pobjtype = PobjButtons.GetType()
   For Each PobjObject In Pobjtype.GetMembers
   LstDisplay.Items.Add(PobjObject.ToString())
   Next
   End Sub
   End Class


相关内容:

  1. .net面试题
  2. 面向对象概念面试题(.NET)
  3. .NET概念性的面试题
  4. .NET概念性的面试题
  5. ASP.net和ADO.net面试题
  6. 一篇.NET面试题