Skip to content
Search lessons, topics, tests…
Esc

    ↑ ↓ moveEnter openEsc close
    C# Language: all courses in this track

    Guided course · C# Language

    C# Internals: Boxing and Unboxing

    Boxing and unboxing from first principles: the IL behind them, hidden boxing in interfaces, collections and equality, the GC and CPU cost, and how to find and remove boxing, with a coding exercise and a benchmark.

    Advanced7 modules · 27 lessons · 3 h 50 min · 2 free

    Module 1 · How Boxing and Unboxing Work

    4 lessons · 20 min
    1. 01First principles: why boxing existsFree3 min
    2. 02Boxing step by stepFree3 min
    3. 03C# to IL: seeing the conversion (included with Full Access)11 min
    4. 04Unboxing: validation, address, and copy (included with Full Access)3 min

    Module 2 · Hidden Boxing in Real Code

    4 lessons · 20 min
    1. 05Copy semantics, identity, and mutable-struct traps (included with Full Access)3 min
    2. 06Interfaces: when a struct boxes and when it does not (included with Full Access)4 min
    3. 07Hidden boxing patterns (included with Full Access)10 min
    4. 08Collections: same Big O, radically different allocation behavior (included with Full Access)3 min

    Module 3 · Equality, Hashing and Boxing Costs

    4 lessons · 20 min
    1. 09Equality and hashing without accidental boxing (included with Full Access)11 min
    2. 10Special boxing rules (included with Full Access)3 min
    3. 11GC and CPU cost model (included with Full Access)3 min
    4. 12Bad versus good production designs (included with Full Access)3 min

    Module 4 · Tracing and Measuring Boxing

    4 lessons · 33 min
    1. 13A complete worked trace (included with Full Access)3 min
    2. 14How to inspect and measure (included with Full Access)12 min
    3. 15Final quiz: two questions (included with Full Access)6 min
    4. 16Coding exercise: remove hidden boxes (included with Full Access)12 min

    Module 5 · Benchmarks, Answers and Reference

    4 lessons · 36 min
    1. 17Performance challenge: BenchmarkDotNet (included with Full Access)11 min
    2. 18Quiz answer key and reasoning guide (included with Full Access)9 min
    3. 19Compact reference sheet (included with Full Access)8 min
    4. 20Mastery checklist and next steps (included with Full Access)8 min

    Module 6 · Sources and Verification

    1 lesson · 6 min
    1. 21Sources and further verification (included with Full Access)6 min

    Module 7 · Module Practice Tests and Final Mock

    6 lessons · 1 h 35 min
    1. 22Practice Test: How Boxing and Unboxing Work (included with Full Access)12 min
    2. 23Practice Test: Hidden Boxing in Real Code (included with Full Access)12 min
    3. 24Practice Test: Equality, Hashing and Boxing Costs (included with Full Access)12 min
    4. 25Practice Test: Tracing and Measuring Boxing (included with Full Access)12 min
    5. 26Practice Test: Benchmarks, Answers and Reference (included with Full Access)12 min
    6. 27Final Mock Interview: 25 Questions on C# Boxing and Unboxing (included with Full Access)35 min