Boxing is the process of conversion of a variable to object where as unboxing is the process of conversion of object to variable
C#
int i = 123;
object o = (object)i; // boxing
C#
o = 123;
i = (int)o; // unboxing
C#
int i = 123;
object o = (object)i; // boxing
C#
o = 123;
i = (int)o; // unboxing
No comments:
Post a Comment