Skip to content
Codescope

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

BeginnerStart here — no prior programming experience required.

01Foundations

4 of 4 live

The type system's central division.

  1. 01

    struct vs class

    One keyword decides whether assignment copies the data or just the handle.

    intro8 min6 steps
    0%
  2. 02

    Boxing & unboxing

    Assigning an int to an object allocates. The syntax gives no hint that it happened.

    core8 min7 steps
    0%
  3. 03

    Nullable value types & null safety

    int? is a struct; nullable reference types are a compiler promise.

    core8 min6 steps
    0%
  4. 04

    Properties, fields & auto-properties

    What the compiler generates behind { get; set; }.

    intro7 min6 steps
    0%
IntermediateBuild on the fundamentals with the mechanics working developers meet daily.

02Memory & resources

0 of 2 live

Allocation, collection, and deterministic cleanup.

  1. 05

    Garbage collection & generations

    upcoming

    Gen 0, 1, 2 and the large object heap.

  2. 06

    IDisposable & using

    upcoming

    Deterministic release for things the GC cannot schedule.

03Collections & LINQ

1 of 4 live

Querying data in the language itself.

  1. 07

    Arrays & List<T>

    upcoming

    Capacity, growth and the cost of inserting at the front.

  2. 08

    Inside Dictionary<K,V>

    upcoming

    Buckets, entries and why GetHashCode must agree with Equals.

  3. 09

    LINQ & deferred execution

    Building a query runs nothing. The last operator pulls each element through, one at a time.

    core10 min7 steps
    0%
  4. 10

    The LINQ operators

    upcoming

    Where, Select, GroupBy, Join and the shapes they produce.

AdvancedDeep internals, specialist tooling, and the topics you reach for at scale.

04Delegates & async

1 of 4 live

Code as data, and work that takes time.

  1. 11

    Delegates & events

    upcoming

    A typed reference to a method, and the publish/subscribe pattern.

  2. 12

    Lambdas & closures

    upcoming

    What gets captured, and why the loop-variable bug used to happen.

  3. 13

    async / await

    await does not wait. It returns, and arranges to be called back.

    deep11 min7 steps
    0%
  4. 14

    Tasks, cancellation & exceptions

    upcoming

    Cooperative cancellation, and where async exceptions surface.

IntermediateBuild on the fundamentals with the mechanics working developers meet daily.

05Types & modern C#

0 of 5 live

Abstraction and the features that shaped current style.

  1. 15

    Interfaces & generic constraints

    upcoming

    Constraining a type parameter to something you can actually call.

  2. 16

    virtual, override & new

    upcoming

    Three keywords, and which one silently hides a method.

  3. 17

    Records & value equality

    upcoming

    Generated equality, with-expressions and immutability by default.

  4. 18

    Pattern matching

    upcoming

    switch expressions, type patterns and deconstruction.

  5. 19

    Extension methods

    upcoming

    Static methods that look like instance methods — and how LINQ is built.

AdvancedDeep internals, specialist tooling, and the topics you reach for at scale.

06Performance

0 of 4 live

Allocation-free code for hot paths.

  1. 20

    Span<T> & ReadOnlySpan<T>

    upcoming12 min

    A 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
  2. 21

    ValueTask & pooled awaitables

    upcoming10 min

    Skip 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
  3. 22

    stackalloc & Span<T>

    upcoming9 min

    Allocate 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
  4. 23

    ref struct — types that never leave the stack

    upcoming10 min

    The 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 live

Patterns beyond await, when correctness or throughput starts to bite.

  1. 24

    System.Threading.Channels

    upcoming11 min

    A 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
  2. 25

    IAsyncEnumerable<T> & await foreach

    upcoming11 min

    LINQ 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
  3. 26

    ConfigureAwait & context capture

    upcoming10 min

    Why 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
  4. 27

    SynchronizationContext & TaskScheduler

    upcoming11 min

    The 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 live

Code that writes code — at compile time and at runtime.

  1. 28

    Source generators

    upcoming13 min

    Read 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
  2. 29

    Expression trees & Expression<T>

    upcoming12 min

    A 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()
  3. 30

    Reflection & Type

    upcoming10 min

    Ask 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
  4. 31

    System.Reflection.Emit

    upcoming12 min

    Generate 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 live

Talking to native code, and stepping outside the safe managed world.

  1. 32

    P/Invoke: calling native code

    upcoming12 min

    Bind 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
  2. 33

    unsafe & pointers in C#

    upcoming11 min

    Yes, 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
  3. 34

    Fixed-size buffers & inline arrays

    upcoming9 min

    Embed 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.