Boxing is the process of converting a variable from value type to reference type.
example:
int i=6;
double d=85.87658;
d=Convert.ToDouble(i);
console.write(d);//it prints d value as 6.
Unboxing is the process of converting a variable from reference type to value type.
example:
int i=6;
double d=85.87658;
i=Convert.ToInt32(d);
console.write(i);//it prints i value as 86.
No comments:
Post a Comment