Yesterday I was playing with finding all UpdatePanel
controls on page during generating response in ASP.NET. Since object with this information is private itself and collection of panels is private in that object, I had to write some code to extract that data. I ended up with to extension methods for Object
type, for getting private field an private property. It’s pretty straightforward, besides one thing: since member is private. And we don’t know in witch type exactly (every type in base/descendant hierarchy have it’s one private members) we have to search them all. So this is final code: Continue reading “Getting private field or property from object”