Template Method Pattern and constructors
Motivation Often you want to have the possibility to call a special abstract or virtual Initialize -method in a constructor of a base class to set individual...
Motivation
Often you want to have the possibility to call a special abstract or virtual Initialize-method in a constructor of a base class to set individual initializing things in an override of this Initialize-method in a derived class.
This is similar to the GOF-Pattern “Template Method”. But with C# this ends up with a warning “Virtual member call in constructor”. Why we get this warning?
To show the effect of this approach, lets have a look at the source and the calling graph during runtime:

Consequence
You will see, that the constructor of the derived class is called *after* the call of the Initialize-method of this class. So you should be carefully if you set up things in the derived constructor and use later in the Initialize-method. Samples of such information could be identity or logging stuff.
But if you don’t have a correlation between the constructor and the Initialize-method you could use it.