Saturday, 10 December 2011

Boxing and Unboxing

Boxing is the process of converting a value type to the type object.
e.g

int i = 123;
object o = (object)i; // boxing

Unboxing extracts the value type from the object.
o = 123;
i = (int)o; // unboxing

No comments:

Post a Comment