Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

boxing

Wrapping a value type in an object on the heap.

Boxing converts a value-type value to object or an interface type by copying it into a heap allocation; unboxing copies it back out and requires the exact type.

Loading interactive…

Examples

  • object o = 42; boxes the int into an object on the heap; int n = (int)o; unboxes it again.

Read the full section →