Ok, what I thought I had figured out isn't working. Can anyone tell me why
my lenght for propertyinfo always comes up zero?
Public Class PdfSupport
Shared Function ReflectPropertyNamesToArrayList(ByVal type As Type, _
ByRef al As ArrayList) As ArrayList
Dim propertyInformation As PropertyInfo() = _
type.GetProperties(BindingFlags.Public)
Dim propertyCount As Int32
For propertyCount = 0 To propertyInformation.Length - 1
Dim currentProperty As PropertyInfo = _
CType(propertyInformation(propertyCount), PropertyInfo)
al.Add(currentProperty.Name.ToString)
Next propertyCount
Return al
End Function
End Class
Public Class Retrieve
Dim _al As New ArrayList
Public Sub New()
Load()
End Sub
Private Sub Load()
LoadArrayList()
End Sub
Private Sub LoadArrayList()
_al =
PdfSupport.ReflectPropertyNamesToArrayList(GetType (MyClass), _al)
End Sub
End Class
Friend Class MyClass
Public ReadOnly Property A() As String
Get
Return "Hello"
End Get
End Property
Public ReadOnly Property B() As String
Get
Return "World"
End Get
End Property
Public ReadOnly Property C() As String
Get
Return "How"
End Get
End Property
Public ReadOnly Property D() As String
Get
Return "Are"
End Get
End Property
Public ReadOnly Property E() As String
Get
Return "You"
End Get
End Property
End Class
"Raymond Lewallen" <Ra******************@nospam.faa.gov> wrote in message
news:eA**************@tk2msftngp13.phx.gbl...
Want to know if/how to get a list of properties that are available in a
class and store the properties names in an arraylist.
TIA,
Raymond Lewallen