Mega Code Archive

 
Categories / VB.Net Tutorial / Reflection
 

Search for the indexed property whose parameters match the specified argument types and modifiers

Imports System Imports System.Reflection Public Class MyPropertyClass     Private myPropertyArray(9, 9) As Integer     Default Public Property Item(ByVal i As Integer, ByVal j As Integer) As Integer         Get             Return myPropertyArray(i, j)         End Get         Set(ByVal Value As Integer)             myPropertyArray(i, j) = Value         End Set     End Property End Class 'MyPropertyClass Public Class MyTypeClass     Public Shared Sub Main()         Dim myType As Type = GetType(MyPropertyClass)         Dim myTypeArray(1) As Type         Dim myPropertyInfo As PropertyInfo = myType.GetProperty("Item",GetType(Integer), myTypeArray, Nothing)         Console.WriteLine(myType.FullName + "." + myPropertyInfo.Name + " has a property  type of " + myPropertyInfo.PropertyType.ToString())     End Sub End Class