Hi friend,
First of all, u hav written wrong.
It is UnBoxing no InBoxing.
Lets see:
When u want to use a integer in any string or u want to convert any integer variable into string, U simply write
string s= 20.ToString();
This is called Boxing, means u hav a value type & u want a reference type then the Compiler create an object Box into which it places the value of value type.
eg.
int n=5;
//Create a box to hold the value of n
object obj=n;
//U know thar object is the datatype that can hold any data type
//Now u wnat to use ur integer value again, so u will unbox it
int m = (int)obj;
when u will do unboxing, Casting is must. If u will not do, thenm compiler will generate an error.
Regards,
Anuj Rathi
|