Monday, June 20, 2016

Boxing

Boxing is used to store the value types in garbage-collector heap. Boxing is an implicit conversion of value types to the type object (reference type). Boxing a value type allocates the object instance on the heap and copies the value into the new object.

Eg:
int i=123;
//Boxing copies the value of “i” into object “o”

Object o=i;    


No comments:

Post a Comment