Overview: What are extension members?
Extension members allow you to define additional members for existing types without modifying their definitions. With them, you can add functionality to existing types you don’t have access to or don’t control, for example, built-in types or types from an API or commercial library.
Extension methods have been a feature of C# since version 3.0 in 2007, so the concept has been around for some time in .NET. However, traditional extension methods were just that – methods only. Extensions could not be created for properties, fields, or operators. You couldn’t create static extensions and they couldn’t easily participate in interfaces. However, new syntax in C# 14 allows both instance and static properties and methods, as well as operators.
Classic extension methods
Let’s quickly review what a classic extension method looks like. We’ll extend the DateTime structure to check the first Monday of any quarter. You might see code like this in manufacturing scenarios where production runs need to start on a specific day, such as the first Monday of a quarter. The code looks something like this:
public static DateTime FirstMondayOfQuarter(this DateTime dateTime, int quarter)
{
if (quarter is < 1 or > 4)
throw new ArgumentOutOfRangeException(nameof(quarter),
"Quarter must be between 1 and 4.");
var year = dateTime.Year;
var firstMonth = (quarter - 1) * 3 + 1;
var date = new DateTime(year, firstMonth, 1);
var offset = ((int)DayOfWeek.Monday - (int)date.DayOfWeek + 7) % 7;
return date.AddDays(offset);
}
Notice that to make the extension method you must make the class and method static, and use the this keyword to indicate which type to extend. While the definition uses the static keyword, it’s not a static member.
Code to use this extension method looks like the following:
DateTime myDate = DateTime.Now;
for (var i = 1; i <= 4; i++)
{
Console.WriteLine(myDate.FirstMondayOfQuarter(i).ToShortDateString());
}
Because it’s not a static method, you can’t just call DateTime.FirstMondayOfQuarter(2). Calling DateTime.Now (or any DateTime member) creates a new instance of a DateTime.
Extension members in C# 14
Use the new extension block inside a static class to define extensions. The extension block accepts the receiver type (the type you want to make an extension for), and optionally, a receiver parameter name for instance members. Adding the parameter name is recommended for clarity. Here’s the syntax:
extension(Type) { … } // plain extension block
extension(Type parameterName) { … } // extension block with a parameter name
If we want to convert a classic extension method to a new extension member, we can use Rider. Rider has a handy intention action for this, just press Alt + Enter and choose Move to extension block:

The code to use it doesn’t change. However, you can now call the code without having to create an instance first, like this:
Console.WriteLine(DateTime.Now.FirstMondayOfQuarter(i).ToShortDateString());
So you won’t need to change any calling code unless you want to.
To create an extension property, use an extension block like you would for any extension member. The rest of the code looks very natural like regular C# code.
public static class DateTimeExtensions
{
extension(DateTime date)
{
public static bool isWeekend(DateTime d) =>
d.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday;
}
}
// To use it:
if (DateTime.Today.IsWeekend)
{
// No work today, yay!
}
Notice that in the extension block you define methods, properties, and other members without using the this parameter syntax for each member.
A goal of the C# team was to ensure that existing code doesn’t break, so then the syntax you use becomes a matter of style. There’s no need to change any of your existing extension methods, but Rider’s handy intention action makes it fast and easy to do so.
In Summary
Extension members are beneficial for several scenarios, including transforming helper methods into properties, organizing related extensions, incorporating static constants or factories into existing types, defining operators on external types, and making third-party APIs feel more integrated or native.

This blog post was created with the help of AI tools. Yes, I used a bit of magic from language models to organize my thoughts and automate the boring parts, but the geeky fun and the
in C# are 100% mine.

A Minimal C# Agent Example
Adding a Tool (Because Agents Need Superpowers)
Multi-Agent Orchestration
Where MAF Fits in the Stack
All My Microsoft Agent Framework Content
Blog Posts
YouTube Videos
Livestreams
My GitHub Samples
Why the Release Candidate Matters





