|
Navigation
Search
|
C# 14 touted for extension properties declaration
Wednesday November 19, 2025. 02:33 AM , from InfoWorld
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 field keyword, previewed in.NET 9, maintains auto‑property terseness and injects minimal logic only where needed. nameof accepts 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.
https://www.infoworld.com/article/4092494/c-14-touted-for-extension-properties-declaration.html
Related News |
25 sources
Current Date
Nov, Wed 19 - 04:47 CET
|







