Paul Krill
Editor at Large

C# 14 introduces extension members

news
May 12, 20252 mins

C# 14 preview in .NET 10 Preview 3 adds static extension methods, instance and static extension properties, and a new optional alternative syntax for extension members.

C# programming language C sharp source code example on monitor and bokeh background.
Credit: Tee11 / Shutterstock

C# 14, aΒ planned update to Microsoft’s cross-platform, general purpose programming language, adds an extension member syntax to build on the familiar feature of extension methods.

Extension members allow developers to β€œadd” methods to existing types without having to create a new derived type, recompile, or otherwise modify the original type. The latest C# 14 preview, released with .NET 10 Preview 3, adds static extension methods and instance and static extension properties, according to Kathleen Pollard, principal program manager for .NET at Microsoft, in a May 8 blog post.

Extension members also introduce an alternative syntax for extension methods. The new syntax is optional, and developers do not need to change their existing extension methods. Regardless of the style, extension members add functionality to types. This is particularly useful if developers do notΒ have access to the type’s source code or if the type is an interface, Pollard said. If developers do not like using !list.Any(), they can create their own extension method IsEmpty(). Starting in the latest preview, developers can make that a property and use it just like any other property of the type. Using the new syntax, developers also can add extensions that work like static properties and methods on the underlying type.

Creating extension members has been a long journey andΒ many designs have been explored, Pollard said. Some needed the receiver repeated on every member; some impacted disambiguation; some placed restrictions on how developers organized extension members; some created a breaking change ifΒ updated to the new syntax; some had complicated implementations; and some just did not feel like C#, she said. The new extension member syntax preserves the enormous body of existing this-parameter extension methods while introducing new kinds of extension members, she added. It offers an alternative syntax for extension methods that is consistent with the new kinds of members and fully interchangeable with the this-parameter syntax. A general release of C# 14 is expected with .NET 10 in November 2025.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a β€œBest Technology News Coverage” award from IDG.

More from this author