Difference Between Boxing and Unboxing
Boxing | UnBoxing | |
1 |
Implicit Conversion.
|
Explicit Conversion.
|
2 |
Convert To Value Type to Reference Type .
|
Convert To Reference Type to Value Type.
|
3 |
Boxing is used to Store Value Types in the Garbage-Collected Heap.
|
UnBoxing an Interface Type to a Value Type that Implements the Interface.
|
4 |
Ex;
int i = 100;
object obj = i;
|
Ex;
int i = 100;
object obj = i;
int j = (int)obj;
|
0 comments:
Post a Comment