NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

7.5.11 typeof operator

The typeof operator is used to obtain the System.Type object for a type.

typeof-expression:
typeof ( type )

The result of a typeof-expression is the System.Type object for the indicated type.

The example

class Test
{
   static void Main() {
      Type[] t = {
         typeof(int),
         typeof(System.Int32),
         typeof(string),
         typeof(double[])
      };
      for (int i = 0; i < t.Length; i++) {
         Console.WriteLine(t[i].Name);
      }
   }
}

produces the following output:

Int32
Int32
String
Double[]

Note that int and System.Int32 are the same type.