The initial value of a field is the default value (§5.2) of the field’s type. When a class is loaded, all static fields are initialized to their default values, and when an instance of a class is created, all instance fields are initialized to their default values. It is not possible to observe the value of a field before this default initialization has occurred, and a field is thus never "uninitialized". The example
class Test { static bool b; int i; static void Main() { Test t = new Test(); Console.WriteLine("b = {0}, i = {1}", b, t.i); } }
produces the output
b = False, i = 0
because b
is automatically initialized to its default value when the class is loaded and i
is automatically initialized to its default value when an instance of the class is created.