Track 04 · C#
The C# track
Value vs reference types, boxing, LINQ pipelines and async state machines.
34 concepts mapped · 6 interactive now · 39 steps · free, no login
01Foundations
4 of 4 liveThe type system's central division.
- 01
struct vs class
One keyword decides whether assignment copies the data or just the handle.
intro8 min6 steps0% - 02
Boxing & unboxing
Assigning an int to an object allocates. The syntax gives no hint that it happened.
core8 min7 steps0% - 03
Nullable value types & null safety
int? is a struct; nullable reference types are a compiler promise.
core8 min6 steps0% - 04
Properties, fields & auto-properties
What the compiler generates behind { get; set; }.
intro7 min6 steps0%
02Memory & resources
0 of 2 liveAllocation, collection, and deterministic cleanup.
- 05
Garbage collection & generations
upcomingGen 0, 1, 2 and the large object heap.
- 06
IDisposable & using
upcomingDeterministic release for things the GC cannot schedule.
03Collections & LINQ
1 of 4 liveQuerying data in the language itself.
- 07
Arrays & List<T>
upcomingCapacity, growth and the cost of inserting at the front.
- 08
Inside Dictionary<K,V>
upcomingBuckets, entries and why GetHashCode must agree with Equals.
- 09
LINQ & deferred execution
Building a query runs nothing. The last operator pulls each element through, one at a time.
core10 min7 steps0% - 10
The LINQ operators
upcomingWhere, Select, GroupBy, Join and the shapes they produce.
04Delegates & async
1 of 4 liveCode as data, and work that takes time.
- 11
Delegates & events
upcomingA typed reference to a method, and the publish/subscribe pattern.
- 12
Lambdas & closures
upcomingWhat gets captured, and why the loop-variable bug used to happen.
- 13
async / await
await does not wait. It returns, and arranges to be called back.
deep11 min7 steps0% - 14
Tasks, cancellation & exceptions
upcomingCooperative cancellation, and where async exceptions surface.
05Types & modern C#
0 of 5 liveAbstraction and the features that shaped current style.
- 15
Interfaces & generic constraints
upcomingConstraining a type parameter to something you can actually call.
- 16
virtual, override & new
upcomingThree keywords, and which one silently hides a method.
- 17
Records & value equality
upcomingGenerated equality, with-expressions and immutability by default.
- 18
Pattern matching
upcomingswitch expressions, type patterns and deconstruction.
- 19
Extension methods
upcomingStatic methods that look like instance methods — and how LINQ is built.
06Performance
0 of 4 liveAllocation-free code for hot paths.
- 20
Span<T> & ReadOnlySpan<T>
upcoming12 minA window into any contiguous memory — array, string, stackalloc — with no copy.
- Slice arrays and strings without allocating
- Use Span<T> to parse without substring copies
- Understand why Span<T> is a ref struct and cannot escape a method
- 21
ValueTask & pooled awaitables
upcoming10 minSkip a Task allocation when async work usually completes synchronously.
- Use ValueTask<T> for hot-path async APIs
- Understand the once-and-only-once await rule
- Pool IValueTaskSource for zero-allocation async
- 22
stackalloc & Span<T>
upcoming9 minAllocate an array on the stack instead of the heap — no GC pressure.
- Use stackalloc for short-lived scratch buffers
- Guard against stack-overflow with size limits
- Combine stackalloc with Span<T> for zero-allocation parsing
- 23
ref struct — types that never leave the stack
upcoming10 minThe compiler enforces that these types cannot be boxed, captured, or stored on the heap.
- Declare a ref struct and understand its constraints
- Return Span<T> from a method by ref-scoping
- Recognise the compiler errors ref struct produces
07Advanced async
0 of 4 livePatterns beyond await, when correctness or throughput starts to bite.
- 24
System.Threading.Channels
upcoming11 minA thread-safe bounded queue with async producers and consumers.
- Build a producer/consumer pipeline with Channel.CreateBounded
- Backpressure via WriteAsync
- Fan-out and fan-in with multiple readers
- 25
IAsyncEnumerable<T> & await foreach
upcoming11 minLINQ for async streams — pull items one at a time as they become available.
- Yield from an async iterator with await foreach
- Cancel a stream cleanly with CancellationToken
- Chain operators with System.Linq.Async
- 26
ConfigureAwait & context capture
upcoming10 minWhy the same code works in a console app and deadlocks in a UI.
- Explain what SynchronizationContext captures
- Use ConfigureAwait(false) in libraries by default
- Recognise the classic UI deadlock from .Result on an async call
- 27
SynchronizationContext & TaskScheduler
upcoming11 minThe hidden context that decides which thread your continuation runs on.
- Understand default vs UI vs ASP.NET Core context
- Post work back to the UI thread from a worker
- Write a custom SynchronizationContext for tests
08Metaprogramming
0 of 4 liveCode that writes code — at compile time and at runtime.
- 28
Source generators
upcoming13 minRead the syntax tree at build time and emit new C# alongside it.
- Implement IIncrementalGenerator
- Emit boilerplate (equality, serialisation) without runtime reflection
- Debug generator output with EmitCompilerGeneratedFiles
- 29
Expression trees & Expression<T>
upcoming12 minA lambda that survives as data — the mechanism behind every LINQ provider.
- Build a tree with Expression.Lambda + Expression.Call
- Visit and rewrite trees with ExpressionVisitor
- Compile a tree at runtime with .Compile()
- 30
Reflection & Type
upcoming10 minAsk a running program about its own types, methods, and attributes.
- Inspect types with GetType, MethodInfo, PropertyInfo
- Instantiate and call by name with Activator.CreateInstance and Invoke
- Cache reflected members — never look up in a hot path
- 31
System.Reflection.Emit
upcoming12 minGenerate IL at runtime — for serialisers, mocks, and dynamic proxies.
- Emit a DynamicMethod and invoke it
- Understand the evaluation stack that IL runs on
- Compare Emit against source generators for the same job
09Interop & unsafe
0 of 3 liveTalking to native code, and stepping outside the safe managed world.
- 32
P/Invoke: calling native code
upcoming12 minBind a C function so C# code can call it as if it were managed.
- Declare an extern method with DllImport
- Marshal strings, structs, and function pointers correctly
- Use LibraryImport (source-generated) instead of DllImport
- 33
unsafe & pointers in C#
upcoming11 minYes, C# has pointers. And yes, they exist for exactly the reasons you'd expect.
- Enable unsafe blocks and use int*
- Pin objects with fixed to prevent GC moves
- Compare Span<T> against pointers for the same problem
- 34
Fixed-size buffers & inline arrays
upcoming9 minEmbed a small array inside a struct without a heap allocation.
- Declare a fixed-size buffer inside an unsafe struct
- Use C# 12 inline arrays as the safe replacement
- Match a native struct layout for interop
The full syllabus is listed above in teaching order. Concepts marked upcoming are mapped but not yet built as visualizations. Progress is kept in this browser only.