Most developers say:
“It converts value types to reference types.”
That’s correct — but misses the performance impact.
❌ Bad answer
It converts value types to reference types.
✅ Senior answer
Boxing converts a value type into an object, causing heap allocation. Unboxing extracts the value type back. Excessive boxing/unboxing can hurt performance due to allocations and casting, especially in high-frequency operations.
int x = 10; object obj = x; // Boxing int y = (int)obj; // Unboxing
Boxing creates heap allocations → more GC pressure → slower performance in loops or high-load systems.
❌ Using object unnecessarily
Causes implicit boxing without realizing.
❌ Boxing in loops
Repeated allocations can destroy performance.
Want to understand real .NET performance traps?
Practice Now