Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 17 Classesprevious at this levelnext at this level 17.4 Fieldsprevious at this levelnext at this level 17.4.5 Variable initializersprevious at this levelnext at this level 17.4.5.2 Instance field initialization Paragraph 11 The instance field variable initializers of a class correspond to a sequence of assignments that are executed immediately upon entry to any one of the instance constructors (§17.10.2) of that class. 2 The variable initializers are executed in the textual order in which they appear in the class declaration. 3 The class instance creation and initialization process is described further in §17.10. Paragraph 21 A variable initializer for an instance field cannot reference the instance being created. 2 Thus, it is a compile-time error to reference this in a variable initializer, as it is a compile-time error for a variable initializer to reference any instance member through a simple-name. [Example: In the example
class A  
{  
   int x = 1;  
   int y = x + 1;   // Error, reference to instance member of this  
}  
the variable initializer for y results in a compile-time error because it references a member of the instance being created. end example]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS