ECMA-334 C# Language Specification

12.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 static flow analysis, that the variable has been automatically initialized or has been the target of at least one assignment. The rules of definite assignment are:

The definite assignment states of instance variables of a struct-type variable are tracked individually as well as collectively. In additional to the rules above, the following rules apply to struct-type variables and their instance variables:

Definite assignment is a requirement in the following contexts:

[Note: This ensures that the function member being invoked can consider the reference parameter initially assigned. end note]

In This Section: