You can add a useful extension method to string or IEnumerable<T> without changing the original type. C# 14 extends that idea: an extension block can declare extension properties and other member forms, so callers can use a property-like expression on a type they do not own.
This is a C# language feature, not a new .NET runtime service or a Visual Studio-only shortcut. C# 14 is supported on .NET 10, and Microsoft documents trying it with the .NET 10 SDK or Visual Studio 2026. This article shows a modest extension property, the older method syntax, and the limits that matter before adopting the feature in a shared library.
Summary
- C# 14 extension blocks can group extension methods and properties for an existing type.
- The declarations live in a non-nested, non-generic
staticclass; the extension block names a receiver type. - An extension property is still external helper code: it cannot access private state or override a real member.
- Use .NET 10 with a C# 14-capable SDK/compiler; older target frameworks do not become C# 14 merely because Visual Studio is updated.
A property on an existing interface
Suppose an application repeatedly checks whether a sequence has any elements. A small extension property can make the call site read naturally:
using System.Collections.Generic;
using System.Linq;
public static class SequenceExtensions
{
extension<T>(IEnumerable<T> source)
{
public bool IsEmpty => !source.Any();
}
}
var names = new[] { "Ada", "Grace" };
if (!names.IsEmpty)
{
Console.WriteLine($"Found {names.Count()} names");
}
The receiver is IEnumerable<T>, and the property body can refer to the receiver variable source. The extension class is static and top-level; the extension declaration sits inside it. This example uses LINQ, so System.Linq must be in scope. It is intended for a modern C# project targeting .NET 10 with a C# 14-capable compiler.
The property improves a call site when the concept is a simple derived fact. It does not make IsEmpty a real property implemented by every sequence type. The code still runs the extension getter, and for a lazy or expensive enumerable, calling Any() may enumerate or otherwise query the source. Avoid repeating the check and then enumerating a one-shot sequence if that sequence cannot safely be traversed twice.
Compare the older extension method form
Before C# 14, you would commonly write:
public static class SequenceExtensions
{
public static bool IsEmpty<T>(this IEnumerable<T> source) => !source.Any();
}
if (!names.IsEmpty())
{
// ...
}
The call looks similar but uses parentheses, and the method is an ordinary static method with a this parameter. Existing extension methods remain valid. There is no reason to convert every helper simply because the newer syntax is available; a method makes inputs and work easier to notice when an operation is expensive or accepts important options.
Where the syntax belongs
An extension block must be declared in a non-nested, non-generic static class. Its receiver can be a type parameterized with generics, as in IEnumerable<T>. The extension block can include supported instance-like or static-like members; the C# reference documents methods, properties and operators. Keep the receiver and its extensions together in a clearly named class and namespace so users know what import enables the member.
Extension members are resolved by the compiler using available extension declarations. That means namespace imports affect whether an extension is in scope, and another extension with the same name can make a call ambiguous. Names should be specific enough to avoid surprising consumers. If the type already has a real member with that name, understand member resolution before choosing an extension with the same name.
What extension members do not provide
Extensions do not alter the original type, add storage to its instances, or bypass encapsulation. The extension code can use only public operations available to it. It cannot become a virtual override or make a third-party type implement a new interface. If the behavior depends on private invariants, ownership or polymorphism, use a wrapper, adapter or a type you control instead.
For a static extension member, the extended type is the receiver type, but the member still lives in your static extension class. Do not assume it becomes a true static member of the original type for reflection, binary compatibility or source ownership purposes. Verify the specific API surface you are publishing against Microsoft’s language reference and the libraries consuming it.
Check the project’s language version
C# language version defaults depend on the target framework and compiler. Microsoft maps .NET 10 to C# 14, while .NET 8 defaults to C# 12 and .NET 9 to C# 13. A newer IDE alone does not make an older target framework’s default language version jump to C# 14. For this example, check the project target framework (net10.0) and SDK used by the build, then confirm dotnet --info and the project’s build output.
If a multi-targeted library still supports older frameworks, avoid assuming every consumer can compile new syntax. You can keep a traditional extension method for broad compatibility, multi-target deliberately, or isolate new syntax in a package version whose compiler requirements you document. Do not set LangVersion to a future or unsupported value just to silence a compiler error; align the target framework and toolchain with the feature’s supported version.
When the property is a good fit
Use an extension property when it is cheap, deterministic and reads like a property of the receiver: a small derived state, for example. Prefer a method when the operation does meaningful work, needs parameters, can fail, has side effects or may enumerate data. A property should not hide a database query or network call from a caller that expects a quick value.
Also consider discoverability. An extension in a niche namespace may be invisible until imported; an overly broad namespace can pollute IntelliSense. Keep the API narrow and document what collection types it suits. In performance-sensitive code, benchmark representative sequences rather than assuming elegant syntax is free.
Common mistakes
- Confusing C# 14 syntax with a .NET runtime API or Visual Studio feature.
- Trying to declare an extension block inside a generic or nested class.
- Expecting an extension to access private fields or override an instance member.
- Hiding expensive enumeration or I/O behind a property.
- Building with a project that targets an older language version and assuming the IDE will compensate.
If the toolchain is new to you, compare the feature version with the project target before adopting it; the recent C# 12 collection expression guide shows the same language-version constraint in another context.
The same habit applies when testing time-sensitive behavior: use TimeProvider for deterministic .NET tests instead of assuming the system clock.
My Take
Extension properties are useful when they make a common, cheap fact easier to read. I would keep computational work visible as a method; the property syntax should clarify a call, not disguise its cost.
Conclusion
C# 14 extension blocks build on familiar extension methods and add property-like members for types you cannot modify. Use a .NET 10/C# 14-capable toolchain, place declarations in a top-level static class and keep extensions small and predictable. For broad library compatibility or expensive work, the older method form may still be the clearer choice.