Value-typed objects are typically stored on the stack, while reference-typed objects are stored on the heap. You can, however, convert an instance of a value type to a reference type object through a process known as boxing.

In the example below, we boxi, assigning it to a reference type variable. Because i derives from System.Object (object), as do all types in .NET, we can assign i to o without doing a cast. A new object is created on the heap, the value of i is copied into it, and the variable o is set to reference the new object.

int i = 46;
object o = i; // Box i

Because a copy of the value-typed object is made, you can change the original object without changing the new object on the heap.