I have three classes Base, Derivedand Final. Derivedcomes from Baseand Finalcomes from Derived. All three classes have a static constructor. A class Derivedas an open static method called Setup. When I call Final.Setup, I expect all three static constructors to be executed, but only one of them starts Derived.
Here is a sample source code:
abstract class Base
{
static Base()
{
System.Console.WriteLine ("Base");
}
}
abstract class Derived : Base
{
static Derived()
{
System.Console.WriteLine ("Derived");
}
public static void Setup()
{
System.Console.WriteLine ("Setup");
}
}
sealed class Final : Derived
{
static Final()
{
System.Console.WriteLine ("Final");
}
}
. , Final.Setup() Derived.Setup(), Final . Base ?
, no-operation Base Base. : - ?