Productivity and performance enhancements also detailed in latest release of the .NET programming language.
Although the C# 14 language was formally launched along with the .NET 10 framework a week ago, Microsoft has put the language update in view again. C# 14 features extension members, a new syntax for declaring extension properties and extension methods. Overall, C# 14โs enhancements improve developer productivity and performance, the company said.
In a November 17 blog post, Microsoft introduced introduced C# 14, the latest update to the companyโs popular object-oriented language for .NET, and described extension members as the headline feature. Extension methods allow developers not only to declare extension properties and extension methods, but also to declare extension members that extend the type, rather than an instance of the type. These new extension members can appear as static members of the type extended. Extensions can include user-defined operators implemented as static extension methods.
Also in C# 14 is a set of capabilities designated as offering more productivity by reducing friction for everyday tasks. These capabilities eliminate boilerplate, remove common conditional blocks, simplify lambda declarations, enhance partial types for source generators, and make nameof more expressive in generic scenarios, according to Microsoft. Typing is reduced and developers get cleaner code, fewer trivial identifiers, and code that communicates intent more cleanly. These capabilities include the following:
- The
fieldkeyword, previewed in .NET 9, maintains autoโproperty terseness and injects minimal logic only where needed. nameofaccepts an unbound generic type. This eliminates the need to choose an arbitrary type just to retrieve the generic typeโs name.- The null-conditional member access operators,
?.and?[], now can be used on the left-hand side of an assignment or compound assignment. - Large generated or sourceโgenerated partial types now can spread event and constructor logic across files. This enables generators or different files to contribute cleanly.
For performance, C# 14 adds implicit conversions among arrays, spans, and read-only spans. This means less ceremony has to be written and the JIT (just-in-time) compiler sees simpler call graphs. That results in fewer temporary variables, fewer bounds checks, and more aggressive inlining in the framework, Microsoft said. Also, C# 14 lets developers declare a compound assignment operator explicitly so that the compiler dispatches directly to the developerโs implementation.


