I have seen many frameworks and helper classes that require you to type base.MethodName()in your inherited class to override some MethodName(). However, some require that this be the last overriden call, while others require its first call. It is not always obvious how it should be called and is usually calculated only by reading documents or samples.
So, can I conclude by saying that where there are no best practices in this area, and method invocation basein redefinition methods depends only on the framework designer? Or is there and I should prefer some design over another? Personally, I find that the call to the base is at first much more natural, as in the designers (this project is applied there). Or are there some circumstances (or areas) that force developers to use a specific call order?
The UPDATE . With @Attila, I now see that most class calls basecan be redesigned. Instead of this:
public virtual void SomeMethod()
{
}
public override void SomeMethod()
{
base.SomeMethod();
}
Do it:
public void SomeMethod()
{
this.SomeMethodUserCode();
}
protected abstract void SomeMethodUserCode();
protected override void SomeMethodUserCode()
{
}
The user loses some flexibility (it can be read as “having fewer options for tearing or making the card work incorrectly”), but the use is simple.