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!

object

The object type is based on System.Object in the NGWS Framework. You can assign values of any type to variables of type object.

All data types, predefined and user-defined, inherit from the System.Object class. The object data type is the type to and from which objects are boxed.

Example

The following sample shows how variables of type object can accept values of any data type and how variables of type object can use methods on System.Object from the NGWS Framework.

using System;
public class MyClass1 {
   public int i = 10;
}
public class MyClass2 {
   public static void Main() {
      object a;
      a = 1;   // an example of boxing
      Console.WriteLine(a);
      Console.WriteLine(a.GetType());
      Console.WriteLine(a.ToString());
      Console.WriteLine();

      a = new MyClass1 ();
      MyClass1 ref_MyClass1;
      ref_MyClass1 = (MyClass1)a;
      Console.WriteLine(ref_MyClass1.i);
   }
}

Output

1
Type: Int32
1

10

See Also

C# Keywords | Reference Types | Value Types