Skip to main content

Boxing and Unboxing in C#

What is  Boxing and Unboxing in .Net?

Boxing- Conversion of value types to reference types.
E.g.-                int i=1;
                        object obj= i;
Unboxing- Conversion of reference types to value types.
E.g.-               int j= (int) obj;

Basically we should avoid boxing and unboxing in practical implementation as it degrades the performance.


Comments