Saturday, May 18, 2013

Boxing and UnBoxing in C#


Boxing means to create an object by boxed a type inside it. In a simpler way boxing is a process by which a value type is converted to  an object type.

Example:-

int a=10;
object obj=a;

When this object is transformed to its real type by casting the object then it is called as Unboxing.

Example:-

obj=10;
a=(int)obj;

No comments:

Post a Comment