I've noticed that a non-static class can have a static constructor:
public class Thing
{
public Thing()
{
Console.WriteLine("non-static");
}
static Thing()
{
Console.WriteLine("static");
}
}
And when you initialize an instance of Thing the static constructor gets called first.
Output:
static
non-static
What would be the need for this? Do you use it to initialize static fields on your instance of the non-static type?
Are there any things to take into consideration when using a static constructor?