Boxing and Unboxing (C# Programming Guide)
Boxing and unboxing enable value types to be treated as objects. Boxing a value type packages it inside an instance of the
i is boxed and assigned to object
o can then be unboxed and assigned to integer variable
In relation to simple assignments, boxing and unboxing are computationally expensive processes. When a value type is boxed, an entirely new object must be allocated and constructed. To a lesser degree, the cast required for unboxing is also expensive computationally. For more information, see Performance.
C# Language Specification
For more information, see the following section in the:
4.3 Boxing and Unboxing