Saturday, October 19, 2019

Difference between boxing and unboxing

Boxing: It is explicit conversion. It is a process of converting the value type to reference type.
For Eg: int, bool is a value type which is used to convert the reference type

Boxing value is stored in heap

UnBoxing: It is implicit conversion. It is a process of converting the reference type to value type.
For Eg: object is a reference type which is used to convert the value type

Boxing value is stored in stack



No comments:

Post a Comment