In our current project we want to fill a grid control with data that is comming from value objects. I can hear you think: “Easy, just use standard .NET data binding!” True, but the grid control that we are currently using does not have full databinding support, and using another control is not an option at this moment.

Rather than implementing some logic that will map the contents of each value object type to a row in our grid control, I chose to create a utility class (named PropertyReflector) that allows us to read and write the properties of our value objects through reflection. Since we need to access properties of value-objects within other value-objects, the utility class must also be able to do deep reflection: getting and setting values of nested objects.

Read the rest of this article for examples and source code!

[03-Feb-2007] Update: uploaded a new version of the PropertyReflector source
[03-Feb-2007] Update: uploaded the nunit tests for PropertyReflector
Continue Reading »