(a)
struct MyStruct {
  int high;
  int low;
}
class MyObject {
  int high;
  int low;
}

(b)
 .class private sequential ansi sealed beforefieldinit MyStruct
       extends [mscorlib]System.ValueType
 {
   .field private int32 high
   .field private int32 low 
 } // end of class MyStruct

(c) 
 .class private auto ansi beforefieldinit MyObject
       extends [mscorlib]System.Object
 {
   .field private int32 high
   .field private int32 low
   .method public hidebysig specialname rtspecialname 
          instance void  .ctor() cil managed
   {
     // Code size       7 (0x7)
     .maxstack  1
     IL_0000:  ldarg.0
     IL_0001:  call instance void [mscorlib]System.Object::.ctor()

     IL_0006:  ret
   } // end of method MyObject::.ctor
 } // end of class MyObject

(d)
object[] my_array = new object[1];
my_array[0] = 1;               // boxed to (object)
int x = (int) my_array[0] + 1; // unboxed

Example 1: The Common Type System (CTS).

Back to Article