C# 9 was released in November 2020 as part of .NET 5. In this article, we will discuss some of the new features in C# 9.0.
Table of Contents
A record is a value type that represents an immutable data structure. Records allow you to define a type that is a lightweight alternative to a class, with automatic properties and a concise syntax for defining them.
Init-only properties allow you to set the value of a property only during object initialization, making it easier to create immutable objects.
C# 9 introduces the ability to define statements at the top level of a file, allowing you to write short scripts or utilities without the need for a class or a Main method.
C# 9 allows you to omit the type of an object when calling the new operator, allowing the type to be inferred from the context.
C# 9 includes several improvements to the pattern matching feature, including support for property patterns, record patterns, and positional patterns.
C# 9 includes several improvements to interpolated strings, including the ability to embed expressions directly in a string, and support for string interpolation in attribute arguments.
C# 9 introduces the IAsyncEnumerable and IAsyncEnumerator interfaces, which allow you to define and consume asynchronous streams of data.
C# 9 includes several improvements to the support for modules, including the ability to import and export top-level statements, and the ability to specify module dependencies.
C# 9 includes several improvements to the nullable reference types feature, including support for non-nullable reference types, and the ability to specify nullability for indexers and events.
OWIN (Open Web Interface for .NET) is an interface between web servers and web applications…
JSON (JavaScript Object Notation) is a commonly used data exchange format that facilitates data exchange…
The CAP theorem is also known as Brewer's theorem. What is CAP Theorem? CAP theorem…
Some of the Key factors that need to consider while architecting or designing a software…
The Interface Segregation Principle (ISP) is one of the SOLID principles of object-oriented design. The…
The Single Responsibility Principle (SRP), also known as the Singularity Principle, is a software design…