C# Programming Language Articles

C# is Microsoft’s modern, statically-typed language for .NET development. This collection explores C# features, language evolution, practical patterns, and techniques for writing clear, efficient code in the C# ecosystem.

Language Evolution and Features

C# has evolved significantly since its creation, adopting features from other languages and innovating independently. Modern C# (10+) includes records for immutable types, nullable reference types for null-safety, pattern matching for elegant code flow, and async/await for asynchronous programming.

Records provide concise syntax for immutable data types with structural equality, ideal for domain models and data transfer objects.

Nullable Reference Types make null-safety explicit at compile time, preventing the infamous “billion-dollar mistake” of null reference exceptions.

Pattern Matching enables elegant code for type checking, null checking, and property matching without verbose if-else chains.

Async/Await abstracts the complexity of asynchronous programming, enabling responsive applications without callback hell.

Practical C# Development

Articles in this section cover language features, effective C# patterns, performance optimization, LINQ mastery, and integration with .NET libraries. Topics include null handling strategies, immutability patterns, error handling approaches, and leveraging type system features.

The goal is writing C# code that’s not just correct but also expressive, maintainable, and performant—code that communicates intent clearly and resists bugs through type safety and language features.

Structured Logging Patterns That Actually Survive Production

Structured Logging That Survives

Every pattern here addresses a failure mode I have either shipped or inherited. Source generators on hot paths, scope opt-in per provider, end-to-end correlation ID propagation, log levels as an ops contract, sink selection as an architecture decision, and OpenTelemetry Logs for greenfield services: six concrete changes that make structured logging trustworthy in production.
TimeProvider Test Patterns That Hold Up in CI and Production

TimeProvider Test Patterns That Hold Up in CI and Production

FakeTimeProvider gives you a clock you control. That solves the easy 30%. The hard part is everything that interacts with that clock: async callbacks, PeriodicTimer, CancellationTokenSource.CancelAfter, BackgroundService loops, and DI lifetime traps that turn deterministic bugs into apparently flaky tests.
.NET 11: The STS Release With C# 15 Union Types and Runtime-Async

.NET 11: The STS Release With C# 15 Union Types and Runtime-Async

STS releases are supposed to be quiet bridges to the next LTS. .NET 11 is not. The union keyword landed in Preview 2, runtime-async is now the default for the BCL and ASP.NET Core shared framework, System.Diagnostics.Process ships a major overhaul, and EF Core gains approximate vector search against SQL Server 2025. All facts sourced from the .NET repositories.
TUnit.Mocks: No Castle, No Reflection, No Drama

TUnit.Mocks: No Castle, No Reflection, No Drama

Most .NET test projects rely on NSubstitute and Castle.DynamicProxy. That foundation is cracking: NativeAOT breaks it, trimming strips it, cold-start costs accumulate. TUnit.Mocks takes a different route: a source generator emits typed mocks at compile time, IService.Mock() (or Mock.Of<T>()) is the entry point, runtime reflection is gone.
The Codebase Doesn't Know You Quit

The Codebase Doesn't Know You Quit

The first four parts of this series treated legacy as something between me and myself: Past Self leaving code for Future Self, with an AI in the middle. That framing is incomplete. Code outlives employment, not just memory. The companies I worked for have forgotten most of what I did there. The repositories haven’t. This is the fifth part of the Code as Legacy series, about the legacy you leave when you’re not around to defend it.