Microsoft released .NET 5.0 - An Unification of .NET and .NET Core Frameworks

Views: 301
Comments: 0
Like/Unlike: 1
Posted On: 17-Feb-2021 05:25 

Share:   fb twitter linkedin
Rahul M...
Moderator
38 Points
18 Posts

[Source: Microsoft]

Microsoft released .NET 5.0 on 10th November, 2020. It's major release .NET family and an unification of .NET and .NET Core Frameworks. It's big release that the next release after .NET Core 3.0. .NET 5 is the next step forward with .NET Core. There will be now one .NET going forward, and we will be able to use it to target Windows, Linux, macOS, iOS, Android, tvOS, watchOS and WebAssembly and more.

So future of .NET is bright as we can see from the below roadmap of .NET, .NET will continue to improve and evolve for several upcoming years:

  • Long Term Support (LTS) releases, are supported for three years after the initial release.
  • Current releases, are supported for three months after a subsequent Current or LTS release.
  • This release marks the fifth major .NET version as an open source project.

 

Platform and Microsoft Support

.NET 5.0 has a nearly similar platform support matrix as .NET Core 3.1, for Windows, macOS, and Linux. If you are already using .NET Core 3.1 on an operating system, you should be able to adopt .NET 5.0 on that same operating system version for the most part. The most significant addition for .NET 5.0 is Windows Arm64.

 

Why .NET 5.0 instead of .NET Core 4.0?

  • skipped version numbers 4.x to avoid confusion with .NET Framework 4.x.
  • dropped "Core" from the name to emphasize that this is the main implementation of .NET going forward. .NET 5.0 supports more types of apps and more platforms than .NET Core or .NET Framework.

Also, 

  • ASP.NET Core 5.0 is based on .NET 5.0 but retains the name "Core" to avoid confusing it with ASP.NET MVC 5. 
  • Likewise, Entity Framework Core 5.0 retains the name "Core" to avoid confusing it with Entity Framework 5 and 6.
  • .NET 5.0 doesn't replace .NET Framework

 

As per Microsoft doc

  • .NET 5.0 is the main implementation of .NET going forward and .NET Framework 4.x is still supported.
  • There are no plans to port the following technologies from .NET Framework to .NET 5.0, but there are alternatives in .NET 5.0:
  • Technology Recommended alternative
    Web Forms ASP.NET Core Blazor or Razor Pages
    Windows Workflow (WF) Open-source CoreWF or Elsa-Workflow

 

There are many important improvements in .NET 5.0

  • .NET 5.0 is already battle-tested by being hosted for months at dot.net and Bing.com (version).
  • Performance is greatly improved across many components in .NET 5.0, Arm64 Performance in .NET 5.0, and gRPC.
  • C# 9.0 and F# 5.0 offer new language improvements such as top-level programs and records for C# 9.0, while F# 5.0 offers interactive programming and a performance boost for functional programming on .NET.
  • .NET libraries have enhanced performance for Json serialization, regular expressions, and HTTP (HTTP 1.1, HTTP/2). They are also are now completely annotated for nullability.
  • P95 latency has dropped due to refinements in the GC, tiered compilation, and other areas.
  • Application deployment options are better, with ClickOnce client app publishing, single-file apps, reduced container image size, and the addition of Server Core container images.
  • Platform scope expanded with Windows Arm64 and WebAssembly.

 

C# 9.0 adds the following features and enhancements to the C# language

  • Records
  • Init only setters
  • Top-level statements
  • Pattern matching enhancements
  • Native sized integers
  • Function pointers
  • Suppress emitting localsinit flag
  • Target-typed new expressions
  • static anonymous functions
  • Target-typed conditional expressions
  • Covariant return types
  • Extension GetEnumerator support for foreach loops
  • Lambda discard parameters
  • Attributes on local functions
  • Module initializers
  • New features for partial methods

 

Top-level programs

Writing a simple program in C# requires a remarkable amount of code:

using System;
class Program
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}

In C# 9.0 we can just write our main program at the top level instead:

using System;
Console.WriteLine("Hello World!");

Or even single line:

System.Console.WriteLine("Hello World!");

 

Logical and property patterns

C# 9.0 includes new pattern matching improvements:

  • Type patterns match a variable is a type
  • Parenthesized patterns enforce or emphasize the precedence of pattern combinations
  • Conjunctive and patterns require both patterns to match
  • Disjunctive or patterns require either pattern to match
  • Negated not patterns require that a pattern doesn’t match

Relational patterns require the input be less than, greater than, less than or equal, or greater than or equal to a given constant.

 

Records

C# 9.0 introduces record type, which is a reference type that provides synthesized methods to provide value semantics for equality. Records are immutable by default. With a record type, the compiler synthesizes several other methods:

  • Methods for value-based equality comparisons
  • Override for GetHashCode()
  • Copy and Clone members
  • PrintMembers and ToString()
public record Person
{
    public string LastName { get; }
    public string FirstName { get; }

    public Person(string first, string last) => (FirstName, LastName) = (first, last);
}

 

References

 

Conclusion

The .NET 5.0 is an important and exciting development in new direction for .NET. Hope, this article will provide a window to start with .net 5.0.

0 Comments
  
 Log In to Chat