Boxing
Boxing means to convert any value-type to object type or to any interface type implemented by this value type. When the CLR boxes a value type, it wraps the value inside a System.Object instance. In the following example,object o is boxing the integer first.
int first=345;
object o=first;
UNBoxing
Unboxing extracts or unwraps the value-type from the object. In the following example, the object o is now unboxed and assigned to the integer variable first
o=345;
first=(int)o;
Leave a comment