The .NET Stacks #50: 🆕 What&#x27;s new with C# 10?
Tags: csharp, dotnet, azure
Published: 2021-05-24 00:05:42

---
title: The .NET Stacks #50: 🆕 What&#x27;s new with C# 10?
published: true
date: 2021-05-23 15:45:00 UTC
tags: csharp,dotnet,azure
canonical_url: https://www.daveabrock.com/2021/05/23/dotnet-stacks-50/
---

_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_](https://dotnetstacks.com/).

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](https://kenbonny.net/introducing-csharp-10). 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](https://kenbonny.net/introducing-csharp-10), 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](https://azure.microsoft.com/en-us/blog/develop-production-scale-modern-web-apps-quickly-with-azure-static-web-apps/) (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](https://www.daveabrock.com/tag/blast-off-blazor/). 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](https://www.daveabrock.com/2021/05/13/azure-static-web-apps-favorite-things/)—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](https://www.youtube.com/watch?v=052xutD86uI), [debugging .NET apps](https://www.youtube.com/watch?v=z2B8OruMT6s), [writing high-performance code](https://www.youtube.com/watch?v=g8MYUfplpt8), [Azure CosmosDB and React](https://www.youtube.com/watch?v=NbkiKdHV0KQ), [gRPC in .NET](https://www.youtube.com/watch?v=d8S9jh6Xj6Y), [GraphQL and Blazor](https://www.youtube.com/watch?v=P7y-OxeSkZ8), and [using .NET and Dapper](https://www.youtube.com/watch?v=ltXWsuqg_mo).

On Day 2, we learned about [the 10 best C# features](https://www.youtube.com/watch?v=Iy6WS4mWlx4), [F#](https://www.youtube.com/watch?v=q3Ies_XTo_s), [legacy refactoring](https://www.youtube.com/watch?v=VaeZW1RISAY), [using null and void in .NET](https://www.youtube.com/watch?v=h7uVMKPHGtM), [async and await best practices](https://www.youtube.com/watch?v=4JHwBX_qQE0), [debugging with JetBrains Rider](https://www.youtube.com/watch?v=KM27QGVwgas), and [containerizing with Kubernetes](https://www.youtube.com/watch?v=B14973mdD0g).

* * *

I'm getting a little antsy about the [release of .NET 6 Preview 4](https://github.com/dotnet/core/issues/6098). 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](https://github.com/dotnet/core/issues/6098#issuecomment-830154834)). 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](https://github.com/dotnet/core/issues/6098#issuecomment-830154834):

![](https://www.daveabrock.com/content/images/2021/05/image-20.png)

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](https://github.com/JamesNK/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](https://www.newtonsoft.com/store/jsonschema) 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](https://endjin.com/blog/2021/05/csharp-serialization-with-system-text-json-schema.html) 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

- Derek Comartin [recaps using Problem Details in ASP.NET Core Web API](https://codeopinion.com/problem-details-for-better-rest-http-api-errors/).
- Steve Gordon [introduces GitHub Actions for .NET developers](https://www.stevejgordon.co.uk/getting-started-with-github-actions-for-dotnet-developers) and [writes about string manipulation in C#](https://www.stevejgordon.co.uk/string-manipulation-in-csharp-best-practices).
- Jon P. Smith [continues his series on evolving modular monoliths](https://www.thereformedprogrammer.net/evolving-modular-monoliths-2-breaking-up-your-app-into-multiple-solutions/).

### 📢 Announcements

- Microsoft announces [the GA release of Azure Static Web Apps](https://azure.microsoft.com/en-us/blog/develop-production-scale-modern-web-apps-quickly-with-azure-static-web-apps).
- Auth0 introduces [Auth0 Actions](https://auth0.com/blog/actions-now-generally-available/).
- Microsoft announces [the May updates for the .NET Framework](https://devblogs.microsoft.com/dotnet/net-framework-may-2021-security-and-quality-rollup-updates).

### 📅 Community and events

- Thomas Claudius Huber [introduces a new MVVM library](https://www.thomasclaudiushuber.com/2021/05/12/introducing-the-mvvmgen-library/).
- InfoQ talks to [Jeremy Likness about EF Core](https://www.infoq.com/articles/deep-diving-ef-core-jeremy-likness/).
- David Ramel [writes about Mercury, a "modern Visual Basic](https://visualstudiomagazine.com/articles/2021/05/10/mercury.aspx)."
- For community standups: Languages & Runtime [talks about source generation](https://www.youtube.com/watch?v=gdnnDeI2XKY), and Machine Learning [differentiates between a data scientist and a data engineer](https://www.youtube.com/watch?v=qGzkuFQenQg).
- The .NET Docs Show [discusses mobile accessibility](https://www.youtube.com/watch?v=BeieWY95WuM).

### 🌎 Web development

- Adam Storr [tests HttpClient](https://adamstorr.azurewebsites.net/blog/catching-all-the-requests-while-testing-with-httpclient).
- Muhammed Saleem [integrates Azure Cosmos DB with ASP.NET Core Web API](https://code-maze.com/azure-cosmos-db-with-asp-net-core-web-api/).
- David Grace [creates a tic-tac-toe game in Blazor](https://www.roundthecode.com/dotnet/blazor/create-tic-tac-toe-blazor-webassembly-in-hour).
- Damien Bowden [presents and verifies verifiable credentials in ASP.NET Core using decentralized identities and MATTR](https://damienbod.com/2021/05/10/present-and-verify-verifiable-credentials-in-asp-net-core-using-decentralized-identities-and-mattr/).
- Burak Guzel [writes a primer on HTTP headers](https://code.tutsplus.com/tutorials/http-headers-for-dummies--net-8039).
- Jason Beres [compares Blazor to React](https://azure.microsoft.com/en-us/blog/develop-production-scale-modern-web-apps-quickly-with-azure-static-web-apps).
- Calvin Allen [works on real-time updates with Postgres and SignalR](https://www.codingwithcalvin.net/real-time-ui-updates-with-postgres-and-signalr/).

### 🥅 The .NET platform

- Tomasz Pęczek [streams JSON Objects (NDJSON) with HttpClient](https://www.tpeczek.com/2021/05/streaming-json-objects-ndjson-with.html).
- Paul DeVito [builds an event-driven .NET application](https://wrapt.dev/blog/building-an-event-driven-dotnet-application-the-fundamentals).
- Kristoffer Strube [uses the PriorityQueue in .NET 6](https://blog.elmah.io/using-the-new-priorityqueue-from-net-6/).
- Ken Bonny [introduces C# 10](https://kenbonny.net/introducing-csharp-10).

### ⛅ The cloud

- Daniel Krzyczkowski [continues writing about Azure Identity](https://daniel-krzyczkowski.github.io/Lost-In-Azure-Cloud-Identity-Serie-Part4/).
- John Reilly [creates a pipeline with the Azure DevOps API](https://blog.johnnyreilly.com/2021/05/08/create-pipeline-with-azure-devops-api/).
- Mark Heath [runs Durable Functions locally with Azurite](https://markheath.net/post/azurite).
- Dave Brock [recaps his favorite things about Azure Static Web Apps](https://www.daveabrock.com/2021/05/13/azure-static-web-apps-favorite-things/).
- Aaron Powell [uses Okta with Azure Static Web Apps](https://www.aaron-powell.com/posts/2021-05-13-using-okta-with-static-web-apps/).

### 📔 Languages

- Jeff Fritz [writes about C# project structure](https://dev.to/dotnet/my-favorite-c-features-part-4-project-structure-454p).
- Sasha Mathews [offers quick tips to improve C# performance](https://levelup.gitconnected.com/5-ways-to-improve-the-performance-of-c-code-for-free-c89188eba5da).
- Matthew Adams [works on C# serialization with JsonSchema and System.Text.Json](https://endjin.com/blog/2021/05/csharp-serialization-with-system-text-json-schema.html).
- Kirtesh Shah [writes about C# pattern matching](https://www.c-sharpcorner.com/article/learn-about-pattern-matching-in-c-sharp/).
- Khalid Abuhakmeh [solves for the next DayOfWeek from DateTime](https://khalidabuhakmeh.com/solve-for-the-next-dayofweek-from-datetime).
- Josef Ottosson [transforms C# objects to a flat string dictionary](https://josef.codes/transform-csharp-objects-to-a-flat-string-dictionary/).
- Matthew Jones [uses C# named arguments to handle complex tests](https://exceptionnotfound.net/using-csharp-named-arguments-to-declutter-complex-tests/).
- Brian Lagunas [walks through async yield return in C#](https://brianlagunas.com/c-async-yield-return-iasyncenumerable-will-change-your-life/).

### 🔧 Tools

- David Ramel [recaps free testing tools for Visual Studio 2019](https://visualstudiomagazine.com/articles/2021/05/07/testing-tools.aspx).
- Abhijit Jana [reminds us that Visual Studio can add using directives automatically on paste](https://dailydotnettips.com/did-you-know-visual-studio-can-add-using-directive-automatically-on-paste/).
- Aaron Stannard [writes about integrating Akka.NET with ASP.NET Core and SignalR](https://petabridge.com/blog/akkadotnet-aspnetcore/).
- Patrick Smacchia [writes about the impacts of 64-bit Visual Studio 2022](https://blog.ndepend.com/visual-studio-2022-64-bits-elements-of-history/).
- Steve Smith [fetches an upstream branch in GitHub](https://ardalis.com/github-fetch-upstream/).

### 🎤 Podcasts

- The Productive C# podcast [talks about global usings in C# 10](https://anchor.fm/productivecsharp/episodes/19--Global-Usings-in-C-10-e10or3e).
- The Coding Blocks podcast [talks about making money with code](https://www.codingblocks.net/podcast/making-money-with-code/).
- The 6-Figure Developer podcast [discusses Orleans with Reuben Bond](https://6figuredev.com/podcast/episode-195-orleans-with-reuben-bond/).
- The .NET Rocks podcast [discusses Visual Studio 2022](https://www.dotnetrocks.com/default.aspx?ShowNum=1739).
- The Azure DevOps podcast [talks about customizing build agents](http://azuredevopspodcast.clear-measure.com/customized-build-agents-with-ahmed-ilyas-episode-140).

### 🎥 Videos

- Azure Enablement [plans for cloud adoption](https://channel9.msdn.com/Shows/Azure-Enablement/How-to-plan-for-cloud-adoption).
- The On .NET Show [talks about supporting VB.NET in .NET 5](https://channel9.msdn.com/Shows/On-NET/Supporting-VBNET-in-NET-5) and [C# ranges](https://channel9.msdn.com/Shows/On-NET/C-Language-Highlights-Ranges).
- Visual Studio Toolbox [talks about Project Reunion](https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Project-Reunion).