In Focus

.NET Core 3 Preview 2 Released

Microsoft has released the second preview of its development platform .NET Core 3.0, which brings many new features in .NET Core 3.0 and C# 8.

As announced earlier by Microsoft, additional support for Windows Forms and WPF, support for Entity Framework 6, the addition of Razor components, and many new capabilities are surfacing with this release.
 
C# 8 Preview 2 is part of .NET Core 3 SDK, and was also released last week with Visual Studio 2019 Preview 2.
 
According to the company, C# 8 is a major release of the language. You can now attach a using declaration to the scope of the current statement block only and then dispose of the object at the end of it. For Switch Expressions, you can now write declarative code that captures your intent instead of procedural code that implements tests for it. Async streams and IEEE Floating-point are other major improvements in C# 8. Floating point APIs are in the process of being updated to comply with IEEE 754-2008 revision.
  1. static State ChangeState(State current, Transition transition, bool hasKey) =>  
  2.     (current, transition) switch  
  3.     {  
  4.         (Opened, Close)              => Closed,  
  5.         (Closed, Open)               => Opened,  
  6.         (Closed, Lock)   when hasKey => Locked,  
  7.         (Locked, Unlock) when hasKey => Closed,  
  8.         _ => throw new InvalidOperationException($"Invalid transition")  
  9.     };  
 Source: Microsoft
 
The preview 2 has added new APIs that will allow access to certain perf-oriented CPU instructions, such as the SIMD or Bit Manipulation instruction sets. Following the introduction of the JSON reader in preview1, the company has now added System.Text.Json.Utf8JsonWriter and System.Text.Json.JsonDocument in this preview.
 
Assembly Unloadability is a new feature that enables a loader context to be unloaded. It releases all memory for instantiated types, static fields and for the assembly itself.
 
To learn more, you can visit the official announcement here.