What is Boxing and Unboxing

The process of wrapping a value type so that it is treated as a reference type is known as boxing. Conversely, converting a reference type to value type is known as unboxing and is performed by casting an object to its original type.

Any primitive-type value can be assigned to an object variable; this is referred to as Boxing.

Unboxing can be used to explicitly convert an object reference to a primitive value.

Reference types include classes, arrays, interfaces, and delegates. Value types includethe primitive data types such as int, char, and byte as well as structure and enum types. Value type and reference type are distinguished by their location in the .NET class hierarchy and the way in which .NET allocates memory for each.