I was reading MSDN Documentation and there seems to be a contradiction.
Static members are initialized before the static member is accessed for the first time and before the static constructor, if there is one, is called.
also in the next paragraph or so,
If your class contains static fields, provide a static constructor that initializes them when the class is loaded.
If static constructor's purpose is to initialize static members of the class then how come it says that static members get initialized even before static constructor gets called?
Is it like if I write:
public static int age = 10;
static SimpleClass()
{
age = 20;
}
Does that mean that age first gets initialized to 10 and then the value is overwritten to 20?