Mega Code Archive

 
Categories / VB.Net / Reflection
 

PropertyInfo GetAccessors

Imports System Imports System.Reflection Imports Microsoft.VisualBasic Public Class Myproperty     Private myCaption As String = "A Default caption"     Public Property Caption() As String         Get             Return myCaption         End Get         Set(ByVal Value As String)             If myCaption <> value Then                 myCaption = value             End If         End Set     End Property End Class Class Mypropertyinfo     Public Shared Function Main() As Integer         Dim MyType As Type = Type.GetType("Myproperty")         Dim Mypropertyinfo As PropertyInfo = MyType.GetProperty("Caption")         Dim Mymethodinfoarray As MethodInfo() = Mypropertyinfo.GetAccessors(True)         Console.Write(Mymethodinfoarray.Length )         Return 0     End Function End Class