0Pricing
C# Academy · Lesson

Developer experience & limitations

See how generators affect developer experience: naming, file discovery, diagnostics, build performance, and safe fallbacks — with C# 6 emulation.

DX & limits overview

Aim: Make generated code easy to use.

  • Predictable names & file locations
  • Helpful diagnostics
  • Small, focused outputs
  • Know limits: build-time only, no runtime reflection

Predictable names

Use stable names (e.g., *.g.cs, DebugId) so users can find generated members quickly.

using System;

// Emulate "predictable" generated naming: suffixes and folders are consistent.
public partial class Order
{
  public int Id;
}

// Simulated generated piece: same partial name, with a clear suffix convention.
public partial class Order // would live in Order.g.cs typically
{
  public string DebugId()
  {
    // predictable member name makes discovery easy
    return "Order#" + Id;
  }
}

public class Program
{
  public static void Main(string[] args)
  {
    Order o = new Order();
    o.Id = 42;
    Console.WriteLine(o.DebugId());
  }
}

All lessons in this course

  1. Concept & use-cases; incremental generators (overview)
  2. Developer experience & limitations
← Back to C# Academy