Boxing is a process of converting a value-type to a reference-type by copying the contents of the value-type to a reference-type object on managed heap. You can read about boxing here as a refresher.
In following code we box an int and do some more operations on boxed object:
int i = 10; // box the value-type i object bi = i; // copy the bi reference to another reference object cbi = bi; // Unbox, multiply, and re-box bi bi = (int)bi * 2; // modify i i = 30;
Let's get the sum of i, bi, and cbi values now:
// Output the sum of i, bi, cbi Console.WriteLine( i + (int)bi + (int)cbi );
What would be printed as sum above?