onsdag 19 september 2012

Print Properties of a Class

Private Sub PrintMemberClassInfo(ByVal memberClass As MemberClass)

    For Each propertyInfoItem As PropertyInfo In memberClass.GetType().GetProperties()
        Dim propValue = propertyInfoItem.GetValue(memberClass, Nothing)
        Dim value As String
        If Not propValue Is Nothing Then
            value = propValue.ToString()
            If propValue.ToString() = "MemberReg.Member" Then
                Dim member As Member = CType(propValue, Member)
                For Each propertyInfo2 As PropertyInfo In member.GetType().GetProperties()
                    Dim propValue2 = propertyInfo2.GetValue(member, Nothing)
                    Dim value2 As String
                    If Not propValue2 Is Nothing Then
                        value2 = propValue2.ToString()
                    Else
                        value2 = "Nothing"
                    End If
                    If value2 = "" Then value2 = """"""
                    Response.Write(" * " & propertyInfo2.Name & " : " & value2 & "
") Next End If Else value = "Nothing" End If If value = "" Then value = """""" Response.Write(propertyInfoItem.Name & " : " & value & "
") Next End Sub

Inga kommentarer:

Skicka en kommentar