Boxing is an approach of converting a value type into a reference type.
int i =100;
object obj = i ; //Boxing
Unboxing is a process of converting a reference that is created through boxing back into a value type, but unboxing requires an explicit conversion.
int j = Convert.ToInt32(Obj);
Value Type =====> Reference Type // Valid (Boxing)
Value Type =====>Reference Type ===>Value Type // Valid (Unboxing)
Reference Type ==> Value Type //Invalid Operation.
Note :- You can not direct convert reference type to value type.
int i =100;
object obj = i ; //Boxing
Unboxing is a process of converting a reference that is created through boxing back into a value type, but unboxing requires an explicit conversion.
int j = Convert.ToInt32(Obj);
Value Type =====> Reference Type // Valid (Boxing)
Value Type =====>Reference Type ===>Value Type // Valid (Unboxing)
Reference Type ==> Value Type //Invalid Operation.
Note :- You can not direct convert reference type to value type.
Thanks for the blog post buddy! Keep them coming... เเจกเครดิตฟรี
ReplyDeleteI surely acquiring more difficulties from each surprisingly more little bit of it Tyson vs Jones 2020 time
ReplyDeleteHey, great blog, but I don’t understand how to add your site in my rss reader. Can you Help me please? แทงมวย
ReplyDelete