|
|
What is Boxing and Unboxing? - .Net
|
Views : 234
|
|
Tagged in : .Net
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Boxing
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.
Example:
int i = 123;
object o = (object)i; // boxing
Unboxing
The conversion of reference type back to the value type is known as unboxing.
Example:
o = 123;
i = (int)o; // unboxing |
|
By Nithya, On - 2010-01-30 |
|
|
|