|C# 9 and F# 5 Released With .NET 5|
|Written by Kay Ewbank|
|Thursday, 12 November 2020|
Microsoft has released C# 9 and F# 5 as part of the .NET 5 release this week. Visual Basic is also included in the 5.0 SDK. It does not include language changes, but has improvements to support the Visual Basic Application Framework on .NET Core.
The improvements to C# 9 are aimed at improving program simplicity, along with support for data-oriented classes. F# 5 adds support for interpolated strings and open type declarations.
The developers say that C# source generators are an important new C# compiler feature, though they are not technically part of C# 9 since it doesn’t have any language syntax. Syntax generators are a new C# compiler feature that means C# developers can inspect user code and generate new C# source files that can be added to a compilation. This is done via a new kind of component The .NET team expects to make more use of source generators within the .NET product in .NET 6.0 and beyond.
C# 9 also adds support for new patterns, including simple type patterns that avoid the need to declare an identifier when the type matches, and relational patterns that correspond to the relational operators <, <= and so on. Support has also been added for logical patterns meaning you can combine patterns with logical operators and, or and not, spelled out as words to avoid confusion with the operators used in expressions.
Another addition to C# 9 is support for a record class.The development team says that while C# has always worked well for classic object-oriented programming where an object has strong identity and encapsulates mutable state, having records is useful if you find yourself wanting the whole object to be immutable and behave like a value. A record is still a class, but the record keyword imbues it with several additional value-like behaviors. Generally speaking, records are defined by their contents, not their identity.
F# has also been updated in the new release. The F# team says that F# 5 marks the start of a new era of F# evolution centered around interactive programming. More practically, the new release adds support for package references in F# scripts with #r "nuget:..." syntax, along with support for Jupyter, nteract, and VSCode notebooks.
Both languages are part of the .NET SDK.
or email your comment to: email@example.com
|Last Updated ( Thursday, 12 November 2020 )|