disable broken tests on net_4_0
[mcs.git] / docs / ecma334 / 14.5.7.xml
blob11d04835a0fa515687a7a3afbdfb6a0a71020d86
1 <?xml version="1.0"?>
2 <clause number="14.5.7" title="This access">
3   <paragraph>A <non_terminal where="14.5.7">this-access</non_terminal> consists of the reserved word this. <grammar_production><name><non_terminal where="14.5.7">this-access</non_terminal></name> : <rhs><keyword>this</keyword></rhs></grammar_production></paragraph>
4   <paragraph>A <non_terminal where="14.5.7">this-access</non_terminal> is permitted only in the block of an instance constructor, an instance method, or an instance accessor. It has one of the following meanings: <list><list_item> When this is used in a <non_terminal where="14.5">primary-expression</non_terminal> within an instance constructor of a class, it is classified as a value. The type of the value is the class within which the usage occurs, and the value is a reference to the object being constructed. </list_item><list_item> When this is used in a <non_terminal where="14.5">primary-expression</non_terminal> within an instance method or instance accessor of a class, it is classified as a value. The type of the value is the class within which the usage occurs, and the value is a reference to the object for which the method or accessor was invoked. </list_item><list_item> When this is used in a <non_terminal where="14.5">primary-expression</non_terminal> within an instance constructor of a struct, it is classified as a variable. The type of the variable is the struct within which the usage occurs, and the variable represents the struct being constructed. The this variable of an instance constructor of a struct behaves exactly the same as an out parameter of the struct type-in particular, this means that the variable must be definitely assigned in every execution path of the instance constructor. </list_item><list_item> When this is used in a <non_terminal where="14.5">primary-expression</non_terminal> within an instance method or instance accessor of a struct, it is classified as a variable. The type of the variable is the struct within which the usage occurs, and the variable represents the struct for which the method or accessor was invoked. The this variable of an instance method of a struct behaves exactly the same as a ref parameter of the struct type. </list_item></list></paragraph>
5   <paragraph>Use of this in a <non_terminal where="14.5">primary-expression</non_terminal> in a context other than the ones listed above is a compile-time error. In particular, it is not possible to refer to this in a static method, a static property accessor, or in a  <non_terminal where="19.6">variable-initializer</non_terminal> of a field declaration. </paragraph>
6 </clause>