The .NET Stacks #50: πŸ†• What's new with C# 10?

This week we see what's coming with C# 10, talk about Azure Static Web Apps, and more.

Dave Brock
Dave Brock

NOTE: This is the web version of my weekly newsletter, released on May 17, 2021. To get the issues right away, subscribe at dotnetstacks.com or the bottom of this post.

Happy Monday! I hope you have a good week. Here's what we have this week:

  • The big thing: Checking in on C# 10
  • The little things: Azure Static Web Apps goes GA, JetBrains .NET days, .NET 6 FileStream improvements, JSON schema validation
  • Last week in the .NET world

The big thing: Checking in on C# 10

Last week, Ken Bonny wrote a post highlighting some new C# 10 features. Of course, it's still a little early, and not all of these changes might make it in. But if language designer Mads Torgersen talks about them publicly, there's a good probability they will.

Ever since Microsoft rolled out records with C# 9, the community has been asking for record struct types. With the C# 9 release of records, the record type is a reference type that enforces value-like behaviors. With C# 10, the team is rolling out a record struct variant that makes the underlying type a value type. So, with a record struct, values will be copied over instead of by reference. Also, on the topic of records, you'll be able to add operators to them.

Apart from this, Ken recaps what else is (probably) coming:

  • Flagging properties of classes, structs, records, or record structs as required
  • A new field keyword that can eliminate backing fields
  • Enabling a single file to enable namespace imports
  • Improvements with lambda attributes and lambda signature inference

There's a lot more with Ken's post, with some good code examples. Make sure to check it out to see what's coming with C# 10.


The little things: Azure Static Web Apps goes GA, JetBrains .NET days, .NET 6 FileStream improvements, JSON schema validation

This week, Azure Static Web Apps became generally available (and to answer everyone's #1 question, yes, apex domains are supported now). I've written about it exhaustively with my Blast Off with Blazor blog series. The gist is this: you integrate your front-end (with various JavaScript frameworks or the Blazor component library) with a backend powered by Azure Functions.

This week, I recapped my favorite things about Azure Static Web Appsβ€”some I knew previously and some I learned about this week. I'm most impressed with the local development story. When using an Azure Static Web Apps CLI, you can leverage a static site server, a proxy to your API endpoints, and a mock authentication and authorization server.

Azure Static Web Apps is now shipping with a Standard tier. For 9 USD/month, you can take advantage of a 99.95% SLA and a "bring your own Functions" model. I find the latter to be most valuable, especially when you want to leverage other Azure Functions triggers (by default, you can only use HTTP triggers with Azure Static Web Apps).


JetBrains hosted their .NET Days conference this week (online, of course). JetBrains always hosts first-class community events, and this was no different. You can check out all the sessions on YouTube.

On Day 1, folks talked about C# source generators, debugging .NET apps, writing high-performance code, Azure CosmosDB and React, gRPC in .NET, GraphQL and Blazor, and using .NET and Dapper.

On Day 2, we learned about the 10 best C# features, F#, legacy refactoring, using null and void in .NET, async and await best practices, debugging with JetBrains Rider, and containerizing with Kubernetes.


I'm getting a little antsy about the release of .NET 6 Preview 4. Since Preview 3 was shipped five weeks ago, and Microsoft aims for a new preview release every month or so, we'll see Preview 4 very soon. It'll be jam-packed with updates for minimal APIs, AOT support, and more.

We'll also see improvements to FileStream. The .NET team is rewriting the library, focusing on Windows (as the Unix implementation, built 20 years later, was already fast). With these changes, the team notes that when used with async I/O, it now never performs blocking work.

"Dave, shut up and show us the benchmarks!" OK, fine:

Look at those allocations! In the example above, reading a 1 MB file is 2.5x faster, and writing is 5.5x faster.


When it comes to serialization with .NET, you've got a few options: mostly, the tried-and-true Newtonsoft.Json (which just surpassed a billion NuGet downloads) and the native System.Text.Json library. Unfortunately, with System.Text.Json, there's no easy way to perform JSON schema validation, and schema validation is a paid feature with Newtonsoft.Json. (There are also quite a few third-party options for schema validation as well.)

This week, Matthew Adams wrote a wonderful post on achieving schema validation with System.Text.Json. He used code generation to create .NET types that represent the structure of the schema (with strongly typed accessors for properties, array/list elements, and so on).


🌎 Last week in the .NET world

This week, we learn more about Azure Static Web Apps, GitHub Actions, modular monoliths, and more.

πŸ”₯ The Top 3

πŸ“’ Announcements

πŸ“… Community and events

🌎 Web development

πŸ₯… The .NET platform

β›… The cloud

πŸ“” Languages

πŸ”§ Tools

🎀 Podcasts

πŸŽ₯ Videos

.NET Stacks