I have classes that store data, and methods to go get data for individual loans.
I have code that walks properties and pulls the data back, but according to the MSDN coding guidelines properties are just supposed to get data, not do anything. My properties actually move to a screen on a mainframe and scrape data. So when I am mousing over a property or moving my mouse over the code in the debugger, sometimes it triggers, changes what screen in the mainframe I'm in. So I'd like to change my reflection walker to also be able to pull back function results and change the unbuffered data to functions.
Public Function GetAllReadableProperties(ByVal obj As Object) As String
Dim result As New System.Text.StringBuilder(300)
For Each Item As System.Reflection.PropertyInfo In obj.GetType.GetProperties()
With Item
If .CanRead Then
result.Append(.Name + ":")
If .GetIndexParameters().Length = 0 Then
Dim value As Object = .GetValue(obj, Nothing)
If value Is Nothing Then
result.AppendLine("<Nothing>")
Else
result.AppendLine(value.ToString)
End If
Else
result.AppendLine("Indexed")
End If
End If
End With
Next
Return result.ToString
End Function
How would I walk the methods also? What would the easiest way to tag certain functions for default walking, or default don't walk? Custom attributes?
Would this code work at all for a structure passed in instead of a class?
I'd like to code this into building a datatable for datagridview display when I get farther along.