Going beyond singleton

#554 – April 27, 2025

Tenant, pooled, and drifter

Going beyond singleton, scoped, and transient lifetimes—tenant, pooled, and drifter
17 minutes by Andrew Lock

In this guide Andrew explains the standard lifetimes available in the .NET DI container and briefly describes the three hypothetical lifetimes. He also shows how you could implement one of these lifetimes in practice.

Build .NET mobile, web, and desktop apps — all from one codebase
sponsored by Uno Platform

Uno Platform gives you: 

Behind the scenes of the new field keyword in C# 14
8 minutes by Marek Sirkovský

Marek dives deep into the new field keyword in C# 14 that enables developers to directly access compiler-generated backing fields within property setters, reducing boilerplate code while maintaining clarity. Though seemingly a minor addition among seven different ways to define properties, this feature addresses a long-requested capability that allows for lightweight transformations without requiring explicit backing fields.

Structured logging in .NET with NativeAOT
5 minutes by Alexandre Henrique T. R. Bonfitto

Alexandre explains how to create a custom structured logger compatible with NativeAOT and trimming by implementing the ILogger interface without using reflection, instead relying on source generators and a JsonSerializerContext that explicitly includes all potential parameter types.

Pattern matching in C#: A simple guide with real-world examples
4 minutes by Arunkumar Gudelli

Arunkumar explores the evolution and power of pattern matching in C#, showcasing how it allows for more elegant, readable code compared to traditional approaches. He details nine different pattern types including declaration, constant, relational, logical, property, positional, var, discard, and list patterns, with examples and use cases for each.

Introducing Incrementalist, an incremental .NET build tool for large solutions
8 minutes by Aaron Stannard

In this guide Aaron introduces Incrementalist v1.0, a command-line tool that significantly reduces build times for large .NET solutions by analyzing git changes and using Roslyn to determine which projects need rebuilding.

And the most popular article from the last issue was:

newsletters