It is governed by Definite Assignment rules in C#. Variable must be definitely assigned before it is accessed.
5.3 Definite assignment
At a given location in the executable code of a function member, a variable is said to be definitely assigned if the compiler can prove, by a particular static flow analysis (§5.3.3), that the variable has been automatically initialized or has been the target of at least one assignment.
5.3.1 Initially assigned variables
The following categories of variables are classified as initially assigned:
• Static variables.
• Instance variables of class instances.
• Instance variables of initially assigned struct variables.
• Array elements.
• Value parameters.
• Reference parameters.
• Variables declared in a catch clause or a foreach statement.
5.3.2 Initially unassigned variables
The following categories of variables are classified as initially unassigned:
• Instance variables of initially unassigned struct variables.
• Output parameters, including the this variable of struct instance constructors.
• Local variables, except those declared in a catch clause or a foreach statement.