Sébastien Rigaux

Tech watch

← All links

C#

The .NET language, covering its type system, asynchronous programming and code design.

Diagram of an agentic loop: the agent acts, observes, evaluates, then repeats or ends.

Agent loops combine action, observation, and evaluation to refine an answer or retry an operation until it meets a criterion. Jesse Liberty demonstrates the pattern in C# with Microsoft Agent Framework: a loop agent, an evaluator, and an iteration limit.

The example contrasts a deterministic marker such as DONE with a model-based judge, then outlines safeguards to add: timeouts, idempotent calls, logging, and cost tracking. Each iteration adds latency and token usage.

Found via C# Digest

C# code showing Windows, Linux and MacOS records, followed by a SupportedOS union containing those three types.

C# 15 introduces the union keyword to represent a value drawn from several types without forcing them into a base class or losing their type information in object. Andrew Lock shows how switch expressions enforce handling every case, and how to declare unions such as Result<T>.

One performance detail to weigh: the generated implementation stores the value in an object, boxing value types. The article demonstrates a custom implementation using TryGetValue to avoid boxing in switch expressions.

Andrew LockFound via C# Digest

Three basketball players illustrate a sequence: the first holds the ball, the second watches through binoculars, and the third shoots toward the hoop.

In Microsoft Agent Framework, ChatClient middleware intercepts messages exchanged with the LLM, while agent middleware operates on the agent’s overall run, including session, identity, or token-budget management. This distinction helps place logging or modification at the right level.

The C# example adds function-invocation middleware to log calls to the Researcher agent’s Tavily tool, without changing the other agents. The trace shows the function name and its arguments.

Found via C# Digest

Yellow “Buy me a coffee” graphic with a stylized cup.

IfItQuacks lets C# code accept objects that match an interface without implementing it or sharing a base class. The [DuckTyped] attribute invokes a source generator that checks compatibility at compile time and creates an adapter—without reflection or dynamic.

Anonymous types can also act as test stubs: an object such as { Name = "Steven", Age = 90 } can satisfy an IPerson interface. Adapters also preserve identity by forwarding Equals, GetHashCode, and ToString to the wrapped instance.

Steven GieselFound via C# Digest

Article banner showing its title, Ricardo Groß’s name, and the date “Jun 11” on a white background.

CodoMetis.ValueRanges offers .NET range types to replace pairs of dates and their scattered logic. Its five variants—finite, unbounded on either side, infinite, and empty—make possible shapes and rules explicit, while operations such as Contains and Overlaps run in memory.

The companion EF Core package bridges the domain model to PostgreSQL: the same operations are translated into SQL operators through Npgsql. The article also explains the design trade-off: abstract records rather than structs, so each variant can be represented by a type hierarchy.

@Found via C# Digest

Metalama automates cross-cutting C# patterns with aspects that generate code at compile time, while checking architecture rules as you edit. The repetitive implementation stays out of business code and the repository, and one aspect can be applied to a method or to a set of methods selected in code.

For example, an aspect can wrap a method in try/catch to log its entry, result, and exceptions. Metalama also lets you preview and debug the transformed code, making those changes inspectable.

Found via C# Digest

DocumentationFR

Major updates in .NET 11: runtime, libraries and SDK

learn.microsoft.comPermalink
Logo .NET 11

This official Microsoft Learn page provides a comprehensive overview of what’s new in .NET 11, currently in release candidate. It details changes in the runtime (performance, native Async, JIT, WebAssembly), libraries (numeric APIs, compression, System.Text.Json, security, LINQ, etc.), SDK (CLI tools, testing, containers, OpenTelemetry), and C# 15 language features. Developers will find a summary of the main improvements, links to updates for ASP.NET Core, EF Core, Windows Forms and WPF, as well as key release dates. Ideal for planning migrations or exploring the new capabilities of the .NET platform.

gewarren