What is Boxing and Unboxing

Value Types are stored on the stack and Reference types are stored on the heap. The conversion of value type to reference type is known as Boxing. Converting reference type back to value type is known as Unboxing.

Value Types - Value types are primitive types that are mapped directly to the FCL. Like Int32 maps to System.Int32,double maps to System.double.

All value types are stored on stack and all the value types are derived from System.V

alueType. All structures and enumerated types that are derived from System.ValueType are created on stack, hence known as ValueType.

Reference Types - Reference Types are different from value types in such way that memory is allocated to them from the heap. All the classes are of reference type. C# new operator returns the memory address of the object.