<?xml version="1.0"?>
<clause number="17.4.2" title="Readonly fields">
  <paragraph>When a <non_terminal where="17.4">field-declaration</non_terminal> includes a readonly modifier, the fields introduced by the declaration are readonly fields. Direct assignments to readonly fields can only occur as part of that declaration or in an instance constructor or static constructor in the same class. (A readonly field can be assigned to multiple times in these contexts.) Specifically, direct assignments to a readonly field are permitted only in the following contexts: <list><list_item> In the <non_terminal where="17.4">variable-declarator</non_terminal> that introduces the field (by including a <non_terminal where="19.6">variable-initializer</non_terminal> in the declaration). </list_item><list_item> For an instance field, in the instance constructors of the class that contains the field declaration; for a static field, in the static constructor of the class that contains the field declaration. These are also the only contexts in which it is valid to pass a readonly field as an out or ref parameter. </list_item></list></paragraph>
  <paragraph>Attempting to assign to a readonly field or pass it as an out or ref parameter in any other context is a compile-time error. </paragraph>
</clause>
