Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deep Reflection in .NET

I need to create the ability to drill through an objects properties like two or three deep. For instance, class A has a property reference to class B, which I need to access class C. What is the best way to do this: straight reflection, or maybe using the TypeDescriptor, or something else?

Thanks.

like image 458
Brian Mains Avatar asked Sep 01 '26 11:09

Brian Mains


1 Answers

It's not too hard to write. I put a few classes together to deal with this so I could serialize properties of a WinForm. Take a look at this class and the related classes.

http://csharptest.net/browse/src/Library/Reflection/PropertySerializer.cs

like image 141
csharptest.net Avatar answered Sep 04 '26 01:09

csharptest.net