The only similar question to this I found was this and the answer suggested having to use Reflector to find out.
What about in just the majority of the cases? Generally, is the base method called first or last in a method?
I noticed in some libraries it is called at the beginning at the method and in the XNA Framework they're called at the end of methods (base.Update, base.Draw, et cetera).
base (C# Reference)The base keyword is used to access members of the base class from within a derived class: Call a method on the base class that has been overridden by another method. Specify which base-class constructor should be called when creating instances of the derived class.
Static Method Static methods are the methods in Java that can be called without creating an object of class. They are referenced by the class name itself or reference to the Object of that class.
It depends on whether you want you derived behaviour to happen before or after the base behaviour.
And don't forget you can call the base method in the middle or not at all.
Having said that, in general it will be called as the first thing. Because then your overriding method has the option to 'overwrite' settings done by the base-class.
But in methods like Close or Dispose it is more customary (sometimes mandatory) to call it in the end.
It entirely depends on what you want to do. There's not really a "general" rule about what should happen. For example, you might want to do some extra validation, then call the base method, then do something else. Or maybe you just want to time how long the base method takes to call.
Treat each case as an individual situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With