© { JSL }
90
Text Box: static Constructor
static Constructor
Folded Corner:
·a static c'tor initialises the type
wcan initialize static fields but not const fields
wcalled by VES when the type is loaded
wcannot be called, no access modifier allowed
struct GoodExample
{
   static GoodExample()
   {
        origin = new Pair(0,0);
   }
...static readonly Pair origin;
}
OK
struct BadExample
{
   public static BadExample()
   {
        x = 42;
   }
...const int x;
}
compile time errors