monotouch uses the real HttpWebRequest
[mcs.git] / docs / ecma334 / 10.8.xml
blob09da35d30d77629a71322611972978421debc587
1 <?xml version="1.0"?>
2 <clause number="10.8" title="Namespace and type names">
3   <paragraph>Several contexts in a C# program require a <non_terminal where="10.8">namespace-name</non_terminal> or a <non_terminal where="10.8">type-name</non_terminal> to be specified. Either form of name is written as one or more identifiers separated by &quot;.&quot; tokens. <grammar_production><name><non_terminal where="10.8">namespace-name</non_terminal></name> : <rhs><non_terminal where="10.8">namespace-or-type-name</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="10.8">type-name</non_terminal></name> : <rhs><non_terminal where="10.8">namespace-or-type-name</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="10.8">namespace-or-type-name</non_terminal></name> : <rhs><non_terminal where="9.4.2">identifier</non_terminal></rhs><rhs><non_terminal where="10.8">namespace-or-type-name</non_terminal><terminal>.</terminal><non_terminal where="9.4.2">identifier</non_terminal></rhs></grammar_production></paragraph>
4   <paragraph>A <non_terminal where="10.8">type-name</non_terminal> is a <non_terminal where="10.8">namespace-or-type-name</non_terminal> that refers to a type. Following resolution as described below, the <non_terminal where="10.8">namespace-or-type-name</non_terminal> of a <non_terminal where="10.8">type-name</non_terminal> must refer to a type, or otherwise a compile-time error occurs. </paragraph>
5   <paragraph>A <non_terminal where="10.8">namespace-name</non_terminal> is a <non_terminal where="10.8">namespace-or-type-name</non_terminal> that refers to a namespace. Following resolution as described below, the <non_terminal where="10.8">namespace-or-type-name</non_terminal> of a <non_terminal where="10.8">namespace-name</non_terminal> must refer to a namespace, or otherwise a compile-time error occurs. </paragraph>
6   <paragraph>The meaning of a <non_terminal where="10.8">namespace-or-type-name</non_terminal> is determined as follows: <list><list_item> If the <non_terminal where="10.8">namespace-or-type-name</non_terminal> consists of a single identifier: </list_item><list><list_item> If the <non_terminal where="10.8">namespace-or-type-name</non_terminal> appears within the body of a class or struct declaration, then starting with that class or struct declaration and continuing with each enclosing class or struct declaration (if any), if a member with the given name exists, is accessible, and denotes a type, then the  <non_terminal where="10.8">namespace-or-type-name</non_terminal> refers to that member. Non-type members (constants, fields, methods, properties, indexers, operators, instance constructors, destructors, and static constructors) are ignored when determining the meaning of a <non_terminal where="10.8">namespace-or-type-name</non_terminal>. </list_item><list_item> Otherwise, starting with the namespace in which the <non_terminal where="10.8">namespace-or-type-name</non_terminal> occurs, continuing with each enclosing namespace (if any), and ending with the global namespace, the following steps are evaluated until an entity is located: </list_item><list><list_item> If the namespace contains a namespace member with the given name, then the  <non_terminal where="10.8">namespace-or-type-name</non_terminal> refers to that member and, depending on the member, is classified as a namespace or a type. </list_item><list_item> Otherwise, if the namespace has a corresponding namespace declaration enclosing the location where the <non_terminal where="10.8">namespace-or-type-name</non_terminal> occurs, then: </list_item><list><list_item> If the namespace declaration contains a <non_terminal where="16.3.1">using-alias-directive</non_terminal> that associates the given name with an imported namespace or type, then the <non_terminal where="10.8">namespace-or-type-name</non_terminal> refers to that namespace or type. </list_item><list_item> Otherwise, if the namespaces imported by the <non_terminal where="16.3.2">using-namespace-directive</non_terminal>s of the namespace declaration contain exactly one type with the given name, then the <non_terminal where="10.8">namespace-or-type-name</non_terminal> refers to that type. </list_item><list_item> Otherwise, if the namespaces imported by the <non_terminal where="16.3.2">using-namespace-directive</non_terminal>s of the namespace declaration contain more than one type with the given name, then the  <non_terminal where="10.8">namespace-or-type-name</non_terminal> is ambiguous and an error occurs. </list_item></list></list><list_item> Otherwise, the <non_terminal where="10.8">namespace-or-type-name</non_terminal> is undefined and a compile-time error occurs. </list_item></list><list_item> Otherwise, the <non_terminal where="10.8">namespace-or-type-name</non_terminal> is of the form N.I, where N is a <non_terminal where="10.8">namespace-or-type-name</non_terminal> consisting of all identifiers but the rightmost one, and I is the rightmost identifier. N is first resolved as a <non_terminal where="10.8">namespace-or-type-name</non_terminal>. If the resolution of N is not successful, a compile-time error occurs. Otherwise, N.I is resolved as follows: </list_item><list><list_item> If N is a namespace and I is the name of an accessible member of that namespace, then N.I refers to that member and, depending on the member, is classified as a namespace or a type. </list_item><list_item> If N is a class or struct type and I is the name of an accessible type in N, then N.I refers to that type. </list_item><list_item> Otherwise, N.I is an invalid <non_terminal where="10.8">namespace-or-type-name</non_terminal>, and a compile-time error occurs. </list_item></list></list></paragraph>
7 </clause>