C# 10 The Main New Features Explained in Less Than 5 Minutes

Abdelmajid BACO
3 min readDec 27, 2022
from https://github.com/dotnet/brand

C# 10 was officially released on September 18th, 2020 as part of .NET 6.

In this article, I will discuss some of the new features that are worth exploring.

Record Structs

Record structs are a new feature in C# 10 that allow developers to create immutable data types using concise syntax. With record structs, developers can quickly define and initialize immutable data that is easy to read and maintain. Record structs are value types while Record classes, which were introduced in C# 9, are reference types.

public record struct Point
{
public double X { get; init; }
public double Y { get; init; }
public double Z { get; init; }
}

Global Using Directives

Global using directives allow developers to include the same set of using statements on all files within a project. This eliminates the need to manually write the same using statement(s) at the top of every class file, streamlining development and making it easier to access namespaces and their members.

global using Xunit;

File-Scoped Namespace

File-scoped namespace is a feature in C# 10, where you can declare namespaces within the scope of a…

--

--

Abdelmajid BACO

Senior Full Stack .Net / Angular Developer, Cloud & Azure DevOps, Carrier Manager, Husband, and Father.