Advanced C#
Duration: 5 Days
Description
This advanced, hands-on course is for experienced C#/.NET developers who want to write high-performance, resilient, production-ready code in modern .NET. Students will dive into async/concurrency internals, memory and allocation patterns, diagnostics and observability, robust API design and versioning, and advanced tooling such as analyzers and source generators. The course also includes a substantial AI-assisted development track, teaching practical workflows with GitHub Copilot (and Copilot Chat) for refactoring, test generation, debugging, documentation, and code review—while emphasizing security, correctness, and verification.
Audience
This course is intended for experienced developers who build and maintain real-world .NET applications and libraries. It is ideal for engineers working on services, backend systems, and larger codebases who want deeper mastery of performance, concurrency, diagnostics, architecture boundaries, and modern build/tooling workflows. Participants should already be comfortable writing non-trivial C# and navigating an existing solution.
Objectives
- Architect robust, versioned public APIs with strong type-safety and composition
- Optimize performance and memory using benchmarking, profiling, and IDisposable
- Develop scalable asynchronous systems using task-based concurrency and cancellation patterns
- Implement production-grade observability through structured logging, metrics, and tracing concepts
- Master modern C# features and functional patterns for cleaner, declarative code
- Establish comprehensive testing strategies with deterministic async and fast feedback loops
- Manage component lifecycles using NuGet multi-targeting, SemVer, and dependency management
- Leverage AI-augmented development while maintaining strict security and IP safety
Prerequisites
Participants should have strong C# fundamentals and real-world experience building and maintaining .NET applications (classes/interfaces, generics, LINQ, exceptions, unit testing basics, and working in Visual Studio/VS Code). Familiarity with asynchronous programming is helpful, but deep expertise is not required. Students should be comfortable reading existing code, using Git, and debugging.
Course Outline
- Module 1: Advanced API Design & Versioning
- Designing stable public surfaces; evolution without breaking changes
- Nullability annotations as contracts; guarding inputs and outputs
- Exceptions vs. result types; error taxonomies and translation boundaries
- Semantic versioning, deprecation strategy, and compatibility testing concepts
- Module 2: Language Features for Maintainability (Modern C#)
- Records: value semantics, equality pitfalls, and appropriate use
- Pattern matching for clarity (property, relational, list patterns)
- Init/required members; designing immutable-ish types safely
- Advanced generics: constraints, variance, and API ergonomics
- Module 3: Async/Await Internals & Correctness
- SynchronizationContext and deadlock scenarios
- ConfigureAwait best practices by application type
- Cancellation tokens, timeouts, and cooperative cancellation design
- ValueTask usage guidelines and tradeoffs
- Module 4: Concurrency Patterns in .NET
- Task coordination: WhenAll/WhenAny, fan-out/fan-in, throttling
- Channels for producer/consumer pipelines
- Thread safety: locks, concurrent collections, and avoiding contention
- Choosing async concurrency vs. parallelism (CPU-bound vs. IO-bound)
- Module 5: Resilience Patterns for Services
- Retries with jitter and backoff; when not to retry
- Circuit breakers and bulkheads (concepts and practical triggers)
- Idempotency keys and safe replays
- Failure classification; partial failure and graceful degradation
- Module 6: Performance Engineering (Benchmarking & Profiling)
- BenchmarkDotNet workflow and common micro-benchmark pitfalls
- Profiling for CPU, allocations, and async hotspots
- Interpreting results; selecting fixes by measured impact
- Performance guardrails: regression tests and thresholds (conceptual)
- Module 7: Memory, Allocations, and GC in Practice
- Generations/LOH awareness and allocation-driven slowdowns
- Object pooling and reuse patterns (and when they backfire)
- Avoiding hidden allocations (LINQ, closures, boxing)
- Allocation patterns in async code and pipelines
- Module 8: Diagnostics & Observability
- Structured logging and designing useful log events
- Correlation IDs, scopes, and cross-component tracing concepts
- Metrics: counters, histograms, SLO-oriented thinking (conceptual)
- Observability for security and incident response (what to log, what not to)
- Module 9: Advanced Tooling (Analyzers, .editorconfig, Quality Gates)
- .editorconfig and consistent codebase standards
- Warnings-as-errors and CI enforcement strategies
- Analyzer categories that move the needle (correctness, perf, security)
- Using analyzers to keep AI-generated code aligned with standards
- Module 10: Metaprogramming (Reflection & Source Generators)
- Reflection costs and design alternatives
- Trimming/AOT considerations (conceptual) and what breaks
- Source generators: replacing runtime reflection with compile-time code
- Maintainability: generator testing and versioning considerations
- Module 11: AI-Assisted Development with GitHub Copilot (Deep Dive)
- Prompt patterns: constraints, examples, acceptance criteria, and “ask for tests first”
- Copilot Chat workflows: codebase Q&A, feature planning, and refactor guidance
- Generating unit/integration tests; strengthening assertions and edge cases
- AI-assisted code review: spot risks, missing validation, and performance regressions
- Module 12: AI for Debugging, Security, and Delivery
- Triage: summarize exceptions/logs, propose hypotheses, and design repro steps
- AI-assisted remediation: generate patch candidates and validate via tests/benchmarks
- Documentation/runbooks: generate and refine operational docs from code and incidents
- Secure AI use: secrets hygiene, licensing/IP awareness, and defending against insecure suggestions