Menu
Microsoft reveals C# 9.0 plans

Microsoft reveals C# 9.0 plans

The next version of Microsoft’s Java rival will offer new capabilities ranging from records to value-based equality

Credit: Dreamstime

Microsoft is plowing ahead with the development of C# 9.0, an upgrade to the company’s type-safe, object-oriented language that will include new capabilities such as records and value-based equality. 

C# 9.0 is due to be part of the .NET 5 development platform, set to arrive in November. C# 8.0 arrived last September. The new features in C# 9.0, detailed at Build this week by C# lead designer Mads Torgersen, include the following:

  • Records, for declaring a whole object to be immutable and have it behave like a value. Records are intended to be seen more like data and less like objects.
  • with expressions, which use object initializer syntax to show what is different in a new object compared to an old one.
  • Improved pattern matching.
  • Value-based equality. All objects inherit a virtual Equals(object) method from the object class. This serves as a basis for the Object.Equals(object, object) static method when both parameters are non-null. Structs override this to have “value-based equality,” allowing comparisons of each field of the struct by calling Equals on them in a recursive manner. Records also do this. Thus, in accordance with “value-ness,” two record objects can be equal without being the same object.
  • Relational patterns, which are patterns corresponding to relational operators <, <=, and so on.
  • Logical patterns, which combine patterns with logical operators and, or, and not, spelled out as words to avoid confusion with operators used in expressions
  • Simple type patterns.
  • Init-only properties, introducing an init assessor that is a variant of the set assessor, for calling during object initialization. These properties address a limitation of object initializers, in which properties must be mutable for these initializers to work.
  • Improved target typing, which is a term describing when an expression gets its type from the context where it is being used. For example, null and lambda expressions are always targeted. With C# 9.0, some expressions that were not previously target-typed now can be guided by their context.
  • Target-typed new expressions, in which the type can be left out if there is a clear type that the expression is being assigned to.
  • Covariant returns, to express that a method override in a derived class has a more specific return type than the declaration in the base type.
  • Positional records, providing an approach to records where contents are given via constructor arguments and can be extracted with positional deconstruction.
  • Top-level programs, to address the issue of too much boilerplate code.

Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Events

Featured

Slideshows

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

This year’s Reseller News 30 Under 30 Tech Awards were held as an integral part of the first entirely virtual Emerging Leaders​ forum, an annual event dedicated to identifying, educating and showcasing the New Zealand technology market’s rising stars. The 30 Under 30 Tech Awards 2020 recognised the outstanding achievements and business excellence of 30 talented individuals​, across both young leaders and those just starting out. In this slideshow, Reseller News honours this year's winners and captures their thoughts about how their ideas of leadership have changed over time.​

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners
Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security

Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security

This exclusive Reseller News Exchange event in Auckland explored the challenges facing the partner community on the cloud security frontier, as well as market trends, customer priorities and how the channel can capitalise on the opportunities available. In association with Arrow, Bitdefender, Exclusive Networks, Fortinet and Palo Alto Networks. Photos by Gino Demeer.

Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security
Reseller News welcomes industry figures at 2020 Hall of Fame lunch

Reseller News welcomes industry figures at 2020 Hall of Fame lunch

Reseller News welcomed 2019 inductees - Leanne Buer, Ross Jenkins and Terry Dunn - to the fourth running of the Reseller News Hall of Fame lunch, held at the French Cafe in Auckland. The inductees discussed the changing face of the IT channel ecosystem in New Zealand and what it means to be a Reseller News Hall of Fame inductee. Photos by Gino Demeer.

Reseller News welcomes industry figures at 2020 Hall of Fame lunch
Show Comments