Menu
Microsoft’s C# 9.0 begins to take shape

Microsoft’s C# 9.0 begins to take shape

Proposed capabilities for C# 9 include simplified parameter null validation, record types, and switch expressions

Credit: Lukas

Having just published C# 8.0 in late September, Microsoft has already begun planning C# 9.0. The next version of Java’s archrival could gain switch expressions, record types, and simplified parameter null validation code, among a multitude of other capabilities.

With the C# language being open source, Microsoft expressed it is working with the community to propose features for the next version. The project’s GitHub page has not cited a serious arrival date for the upgrade, just saying it was due by January 1, 2090.

Among the capabilities eyed for C# 9.0 thus far include:

  • Simplified parameter null validation code, allowing for standard null validation on parameters to be simplified using a small annotation on parameters.
  • Support for a switch expression as a statement expression when every arm’s expression is also a statement expression. No common type among the arms is needed when used as a statement expression.
  • Records, a simplified declaration form for C# class and struct types combining benefits of similar features. Records provide a mechanism for declaring a datatype by describing members of the aggregate as well as additional code or deviations from the usual boilerplate, if any.
  • CallerArgumentExpression, enabling developers to capture the expression passed to a method, to allow better error messages in diagnostic/testing APIs and reduce keystrokes.
  • Relaxing of ordering constraints around “ref” and “partial” modifiers on type declarations.
  • Primary constructors, to reduce programming overhead by putting constructor arguments directly in scope throughout a class, obviating the need to explicitly declare a backing field.
  • Top level statements and member declarations, embracing a scripting dialect within C#. The C# compiler currently understands a dialect of the language used for scripting and interactive purposes. Use of the scripting dialect has been relatively minor but usage is picking up. The plan is based on a belief that extensions to C# could be added to the language rather than having a separate scripting dialect.
  • Support for covariant return types, allowing an override method to have a more-derived reference type than the method it overrides.
  • Static delegates, providing a lightweight callback capability to the language.
  • Support for a nullable-enhanced common type, countering a current situation where current common-type algorithm results are counter-intuitive. With the proposed change, an expression such as condition 7 1 : null would result in a value of type int?code.
  • Permitting ternary operation with int? and double operands.
  • To avoid capturing any local state when supplying lambda functions for method arguments, the lambda declaration would be prefixed with the static keyword. This makes the lambda function like a static method.

C# is an object-oriented and type-safe programming language with roots in the C family, similar to Java. It also supports garbage collection and component-oriented programming, leveraging self-contained, self-describing packages of functionality.


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