DuraSoft
.NET-44
Value type: Boxing and Unboxing
•Boxing is the conversion or copying of a value type to a reference type
–The value types is wrapped into a reference intance
•
•Unboxing is the conversion or copying of a boxed reference to a value type
Int32 a = 4;
Object obj = a; // boxing
Int32 b = (Int32)obj;//unboxing
b = 5;
a
4
4
Obj
b
4
5