[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / docs / ecma334 / 17.6.xml
1 <?xml version="1.0"?>
2 <clause number="17.6" title="Properties">
3   <paragraph>A property is a member that provides access to an attribute of an object or a class. Examples of properties include the length of a string, the size of a font, the caption of a window, the name of a customer, and so on. Properties are a natural extension of fields-both are named members with associated types, and the syntax for accessing fields and properties is the same. However, unlike fields, properties do not denote storage locations. Instead, properties have accessors that specify the statements to be executed when their values are read or written. Properties thus provide a mechanism for associating actions with the reading and writing of an object's attributes; furthermore, they permit such attributes to be computed. </paragraph>
4   <paragraph>Properties are declared using property-declarations: <grammar_production><name><non_terminal where="17.6">property-declaration</non_terminal></name> : <rhs><non_terminal where="24.2">attributes</non_terminal><opt/><non_terminal where="17.6">property-modifiers</non_terminal><opt/><non_terminal where="11">type</non_terminal><non_terminal where="17.6">member-name</non_terminal><terminal>{</terminal><non_terminal where="17.6.2">accessor-declarations</non_terminal><terminal>}</terminal></rhs></grammar_production><grammar_production><name><non_terminal where="17.6">property-modifier</non_terminal>s</name> : <rhs><non_terminal where="17.6">property-modifier</non_terminal></rhs><rhs><non_terminal where="17.6">property-modifiers</non_terminal><non_terminal where="17.6">property-modifier</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="17.6">property-modifier</non_terminal></name> : <rhs><keyword>new</keyword></rhs><rhs><keyword>public</keyword></rhs><rhs><keyword>protected</keyword></rhs><rhs><keyword>internal</keyword></rhs><rhs><keyword>private</keyword></rhs><rhs><keyword>static</keyword></rhs><rhs><keyword>virtual</keyword></rhs><rhs><keyword>sealed</keyword></rhs><rhs><keyword>override</keyword></rhs><rhs><keyword>abstract</keyword></rhs><rhs><keyword>extern</keyword></rhs></grammar_production><grammar_production><name><non_terminal where="17.6">member-name</non_terminal></name> : <rhs><non_terminal where="9.4.2">identifier</non_terminal></rhs><rhs><non_terminal where="11.2">interface-type</non_terminal><terminal>.</terminal><non_terminal where="9.4.2">identifier</non_terminal></rhs></grammar_production></paragraph>
5   <paragraph>A <non_terminal where="17.6">property-declaration</non_terminal> may include a set of attributes (<hyperlink>24</hyperlink>) and a valid combination of the four access modifiers (<hyperlink>17.2.3</hyperlink>), the new (<hyperlink>17.2.2</hyperlink>), static (<hyperlink>17.6.1</hyperlink>), virtual (<hyperlink>17.5.3</hyperlink>, <hyperlink>17.6.3</hyperlink>), override (<hyperlink>17.5.4</hyperlink>, <hyperlink>17.6.3</hyperlink>), sealed (<hyperlink>17.5.5</hyperlink>), abstract (<hyperlink>17.5.6</hyperlink>, <hyperlink>17.6.3</hyperlink>), and extern modifiers. </paragraph>
6   <paragraph>Property declarations are subject to the same rules as method declarations (<hyperlink>17.5</hyperlink>) with regard to valid combinations of modifiers. </paragraph>
7   <paragraph>The type of a property declaration specifies the type of the property introduced by the declaration, and the <non_terminal where="17.6">member-name</non_terminal> specifies the name of the property. Unless the property is an explicit interface member implementation, the <non_terminal where="17.6">member-name</non_terminal> is simply an identifier. For an explicit interface member implementation (<hyperlink>20.4.1</hyperlink>), the <non_terminal where="17.6">member-name</non_terminal> consists of an <non_terminal where="11.2">interface-type</non_terminal> followed by a &quot;.&quot; and an identifier. </paragraph>
8   <paragraph>The type of a property must be at least as accessible as the property itself (<hyperlink>10.5.4</hyperlink>). </paragraph>
9   <paragraph>The <non_terminal where="17.6.2">accessor-declarations</non_terminal>, which must be enclosed in &quot;{&quot; and &quot;}&quot; tokens, declare the accessors (<hyperlink>17.6.2</hyperlink>) of the property. The accessors specify the executable statements associated with reading and writing the property. </paragraph>
10   <paragraph>Even though the syntax for accessing a property is the same as that for a field, a property is not classified as a variable. Thus, it is not possible to pass a property as a ref or out argument. </paragraph>
11   <paragraph>When a property declaration includes an extern modifier, the property is said to be an external property. Because an external property declaration provides no actual implementation, each of its  <non_terminal where="17.6.2">accessor-declarations</non_terminal> consists of a semicolon. </paragraph>
12 </clause>