jeudi 24 mai 2018

Reflection Class Properties

I have a class and I'm trying to loop through all the objects in the class.

The code below always has a count of 0, is there something I'm missing?

Public Class SomeClass
    Public Value1 As String
    Public Value2 As String
    Public Value3 As String
    Public Value4 As String
End Class

Public Function FindClassValue() As Boolean
    Dim someobj As New SomeClass
    Dim myType As Type = someobj.GetType
    Dim properties As System.Reflection.PropertyInfo() = myType.GetProperties()
    For Each p As System.Reflection.PropertyInfo In properties
        Debug.WriteLine(p.Name)
    Next
    Return Nothing
End Function





Aucun commentaire:

Enregistrer un commentaire