I have a base class that has a method executed by derived classes. The method is raised by the constructor of the derived class and some methods or properties in it. I need to determine if this came from the constructor of the instance of this derived class or after it (at runtime).
The following example explains what I need:
public class Base { public Base() { } protected void OnSomeAction(object sender) {
The problem is that I cannot change the signature or arguments, because I cannot change the derived classes. Basically, I thought it would determine if the derived class (sender) was completely built.
So, the implementation is the same as it is. I cannot make changes to the base class that the derived classes break down. I can only make changes in the base class: /
Is it possible, good or not? Unfortunately, even some reflection magic or a similar hacker approach is welcome, as it is necessary: /.
Thanks!
source share