Normally we hear about Boxing and Unboxing concept in C#. Let's see what it actually means.
a. Boxing:
Boxing is a concept of converting the value type variables into Object Types (reference types).
For e.g.
//value type
int x = 100;
//value type to reference type
object temp = x;
b. Unboxing:
a. Boxing:
Boxing is a concept of converting the value type variables into Object Types (reference types).
For e.g.
//value type
int x = 100;
//value type to reference type
object temp = x;
b. Unboxing:
Unboxing is a reverse of Boxing where by the reference types are converted back to value types.For e.g.
//reference type
object temp=100;
//reference type back to value type
int x=(int) temp;
Comments