C # -.net 3.5
I have a family of classes that inherit from the same base class. I want the method in the base class to be called at any time when the resource in the derrive class is accessed (get or set). However, I do not want to write code in each property to call the base class ... instead, I hope that there is a declarative way to "sink" this activity into the base class.
Adding some requirements to the requirement, I need to determine the name of the available property, the value of the property, and its type.
I believe that a solution would be a clever combination of delegate, generics and reflection. I can imagine creating some type of arrays of delegate assignments at runtime, but repeating over MemberInfo in the constructor would affect performance more than I would like. Again, I hope that there is a more direct "declarative" way to do this.
Any ideas are most appreciated!
source
share