2 min read

This Tuesday, Microsoft announced .NET Core 3 Preview 2 with new features in .NET Core 3 and C# 8.

C# 8

The eighth iteration of C# is a major release and includes many new features.

Declarations

Statements don’t need to be indented now.

Switch expressions

C# 8 comes with switch expressions in which you can use the new syntax. Terser syntax returns a value as it is an expression. It’s fully integrated with pattern matching.

Async streams

The compiler and framework libraries should match correctly for async streams to work. You will need .NET Core 3.0 Preview 2 and Visual Studio 2019 Preview 2. Alternatively, you can also use the C# extension for Visual Studio Code.

Floating point improvements in IEEE

The goal is to expose all operations that are needed and they are behaviorally compliant with the IEEE spec.

A fast in-box JSON Writer & JSON document

Two new objects were added—System.Text.Json.Utf8JsonWriter and System.Text.Json.JsonDocument.

Utf8JsonWriter

The Utf8JsonWriter enables a high-performance, non-cached way to write UTF-8 encoded JSON text from common .NET types.

JsonDocument

System.Text.Json.JsonDocument is also added built on top of the Utf8JsonReader. JsonDocument provides enables parsing JSON data and builds a read-only Document Object Model (DOM). It can be queried to support enumeration and random access.

Assembly Unloadability

Assembly unloadability is a new ability of AssemblyLoaderContext. It is transparent and exposed with only a few new APIs. A loader context to be unloaded with this. This releases all of the memory for static fields, instantiated types, and the assembly itself.

Visual Studio support

Using .NET Core 3 for development requires using Visual Studio 2019. WPF and Windows Forms templates were added to the New Project Dialog for easier access via the command line.

These were a select few updates from the new .NET Core 3 Preview 2, for a complete list of changes, visit the Microsoft Blog.

Read next

Microsoft Connect(); 2018: .NET foundation open membership, .NET Core 2.2, .NET Core 3 Preview 1 released, WPF, WinUI, Windows forms open sourced

What to expect in ASP.NET Core 3.0

.NET Core 3.0 and .NET Framework 4.8 more details announced


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.