Revert "Fix WebProxy.BypassProxyOnLocal logic."
[mono.git] / mcs / docs / ecma334 / 14.5.11.xml
1 <?xml version="1.0"?>
2 <clause number="14.5.11" title="The typeof operator">
3   <paragraph>The typeof operator is used to obtain the System.Type object for a type. <grammar_production><name><non_terminal where="14.5.11">typeof-expression</non_terminal></name> : <rhs><keyword>typeof</keyword><terminal>(</terminal><non_terminal where="11">type</non_terminal><terminal>)</terminal></rhs><rhs><keyword>typeof</keyword><terminal>(</terminal><keyword>void</keyword><terminal>)</terminal></rhs></grammar_production></paragraph>
4   <paragraph>The first form of <non_terminal where="14.5.11">typeof-expression</non_terminal> consists of a typeof keyword followed by a parenthesized type. The result of an expression of this form is the System.Type object for the indicated type. There is only one System.Type object for any given type. <note>[Note: This means that for type T, typeof(T) == typeof(T) is always true. end note]</note> </paragraph>
5   <paragraph>The second form of <non_terminal where="14.5.11">typeof-expression</non_terminal> consists of a typeof keyword followed by a parenthesized <keyword>void</keyword> keyword. The result of an expression of this form is the System.Type object that represents the absence of a type. The type object returned by typeof(<keyword>void</keyword>) is distinct from the type object returned for any type. </paragraph>
6   <paragraph>
7     <note>[Note: This special type object is useful in class libraries that allow reflection onto methods in the language, where those methods wish to have a way to represent the return type of any method, including <keyword>void</keyword> methods, with an instance of System.Type. end note]</note>
8   </paragraph>
9   <paragraph>
10     <example>[Example: The example <code_example><![CDATA[
11 using System;  
12 class Test  
13 {  
14    static void Main() {  
15       Type[] t = {  
16          typeof(int),  
17          typeof(System.Int32),  
18          typeof(string),  
19          typeof(double[]),  
20       typeof(void)   };  
21       for (int i = 0; i < t.Length; i++) {  
22          Console.WriteLine(t[i].FullName);  
23       }  
24    }  
25 }  
26 ]]></code_example>produces the following output: <code_example><![CDATA[
27 System.Int32  
28 System.Int32  
29 System.String  
30 System.Double[]  
31 System.Void  
32 ]]></code_example></example>
33   </paragraph>
34   <paragraph>
35     <example>Note that <keyword>int</keyword> and System.Int32 are the same type. end example]</example>
36   </paragraph>
37 </clause>