Library topic

C#

Language features, new syntax and practical C# techniques. 50 links, all featured in The .NET Insider.

Read a live call stack with .NET 11 Runtime Async

Ali Hamza Ansari · blog.elmah.ioIssue 37

Compares the live call stacks of two small console projects: with Runtime Async enabled, the compiler-generated builder frames disappear and application methods are easier to follow. The .NET 11 runtime libraries already use it, while opting your own code in is still a preview. Throughput gains for an ASP.NET Core endpoint are something to measure on your own workload.

Give an order-status hierarchy a known set of cases

Giorgi Kobaidze · dev.toIssue 37

Starts from an OrderStatus switch and the fallback arm you need when another assembly could add a subclass. The C# 15 closed modifier restricts direct subclasses to the defining assembly, so the compiler can check whether a switch covers them. For library authors: the restriction applies one level at a time, so a consumer can still derive from an unsealed subclass.

Where a labeled continue goes after the C# compiler sees it

Giorgi Kobaidze · dev.toIssue 37

C# 15 lets an inner loop name the outer loop directly, as in continue nextOrder;. Opening the compiled example in ILSpy shows that the IL keeps only a branch to the outer loop's continuation point, which explains why a decompiler can show a plain break for code originally written with a labeled continue.

Give a coding agent current C# 15 and .NET 11 examples

Anton Martyniuk · antondevtips.comIssue 37

After Claude proposed a workaround for something .NET 11 already supported, Anton wrote four skills covering C# 15, ASP.NET Core 11 and EF Core 11. The union skill names the target framework, the syntax to use and the older projects where it would fail to compile. Give the agent the same task with and without the skills and build both answers against the SDK your project targets.

Teach the C# compiler when a successful lookup returns a value

Khalid Abuhakmeh · khalidabuhakmeh.comIssue 37

A guide to nullable reference types that goes from #nullable enable to a familiar API design problem: a TryGet method that writes to an out string? parameter. [NotNullWhen(true)] tells the compiler the value is safe in the successful branch, so callers need no extra check or !. Also explains where runtime validation still belongs for external input.

Get started with union types in C# 15

Anton Martyniuk · antondevtips.comIssue 36

Starts from a payment that can take several forms, each with its own data: union types make that fixed set explicit, and the compiler can warn when a switch expression misses a case. The walkthrough covers declarations, pattern matching, closed hierarchies, JSON serialization and ASP.NET Core. Follow one example through declaration, consumption and serialization before changing an existing domain model.

Do union types replace the Result pattern?

Milan Jovanović · milanjovanovic.techIssue 36

Uses a booking example to compare a Result built as a union of T and Error with giving each failure its own type. A single Error type keeps the familiar shape but leaves individual failure codes outside the compiler's exhaustiveness checks. CS8509 is normally a warning, so teams that want missing switch cases to fail the build need to configure that.

Keep the exception-handling basics close at hand

Khalid Abuhakmeh · khalidabuhakmeh.comIssue 36

A reference for try/catch, finally, exception filters and custom exceptions, including rethrowing while preserving the stack trace. The examples target .NET 10 and C# 14, so they apply before a move to the latest release. Worth reading alongside the Result-pattern discussion when reviewing how an application communicates failures.

Explore .NET 11 and C# 15 with Anton

Anton Martyniuk · antondevtips.comIssue 35

A walkthrough of the language, runtime, libraries, ASP.NET Core and EF Core changes, with a section on breaking changes before upgrading. A more practical route through the release than the announcement lists: start with unions and closed hierarchies, then move to the areas your application uses. Read the breaking-change section alongside the examples, because that is where an upgrade plan becomes specific.

Choose an approach for reading Excel files in C#

Khalid Abuhakmeh · khalidabuhakmeh.comIssue 35

Compares ExcelDataReader, ExcelMapper, ClosedXML and lower-level options, using the same data model across the examples. The choice depends on whether you need to stream rows, map them into objects, or read and edit a workbook. He also shows what parsing an .xlsx file without a library involves. A useful reference before adding the next import endpoint or background job.

A modern C# reference to keep nearby

Khalid Abuhakmeh · khalidabuhakmeh.comIssue 35

A cheat sheet with examples for collections, records, pattern matching, LINQ, asynchronous code and null handling, organized for jumping to the syntax you need. The examples target .NET 10 and C# 14, so it covers everyday work and onboarding and does not include the C# 15 additions.

Parse a heavily reused format string once

Sukhpinder Singh · dev.toIssue 34

Moves the parsing of a repeated string.Format template into a reusable CompositeFormat and compares formatting time and allocations over five million calls. Useful when a template comes from a variable or resource and sits on a measured hot path; an occasional formatting call is unlikely to justify the setup.

Smooth noisy data with a C# kernel implementation

James McCaffrey · visualstudiomagazine.comIssue 34

Demonstrates Nadaraya-Watson kernel smoothing, which estimates values from a weighted average of observations. The C# example uses a radial basis function to weight similar inputs more heavily, with a bandwidth parameter controlling the smoothing. Published in Visual Studio Magazine on November 3, 2026.

dotInsights: November's wider .NET reading list

Rachel Appel · blog.jetbrains.comIssue 34

JetBrains' monthly roundup opens with F# units of measure, then collects community articles across .NET, databases, architecture and AI tooling, including NativeAOT dependency trimming, primary constructors and agent workflows. A broad collection, so some links overlap with articles already in this library.

Godot, C# and Rider in one workflow

Anna Ruban · blog.jetbrains.comIssue 33

Rider's Godot support covers GDScript, C# and C++ extensions, with mixed-language debugging and C# tests. The live scene tree and node inspector for C# debugging are previewed in the 2026.3 EAP and need a preview build.

This week in Cursor + .NET — 7 rules

Agentic Architect · dev.toIssue 32

Seven opinionated rules for reviewing agent-generated C#: value objects versus entities, sealed classes, strongly typed IDs, typed configuration, exception rethrowing, query tracking and DI lifetimes. Watch especially for singletons capturing scoped dependencies.

Use C# unions and closed hierarchies in ASP.NET Core

Dmitrii Korolev · .NET BlogIssue 29

How unions and closed hierarchies behave in Minimal APIs, MVC, SignalR, Blazor and OpenAPI, all through System.Text.Json. Unions serialize as the active case with no discriminator, so cases with the same JSON shape need a classifier. Not supported for route, query, header or form binding. For new contracts you control, the post recommends a closed hierarchy with a discriminator.

Explore new features available in C# 15 preview

Bill Wagner · .NET BlogIssue 28

A tour of C# 15: union types, closed hierarchies, collection expression arguments, extension indexers and labeled break and continue, each with before and after code. Written against Preview 7. The updated unsafe model it describes is still a preview feature that needs an explicit opt-in.

Explore union types in C# 15

Bill Wagner · .NET BlogIssue 22

Explains the union keyword in depth: implicit conversions from each case type, exhaustive switch expressions, null handling, unions with their own members, and how existing libraries can opt in with the Union attribute. Written for Preview 2, so the setup steps at the end (declaring runtime types yourself, the preview language version) reflect that early build.

Links go to the original articles. Short descriptions are dotnetdevs.io commentary, not the authors' words.