Extension Members in C# 1404/19/2026
In this post, I explore C# 14's extension members feature and how it is compiled into IL code.
From Extension Methods to Extension Members
Previous versions of C# allowed developers to declare extension methods. The code snippets in this post are for demonstration purposes only and should not be used directly in production applications:
string value = "ThisIsPascalCased"; Console.WriteLine(value.ToCamel()); public static class MyExtensions { public static string ToCamel(this string str) => str.Length switch { 0 => string.Empty, 1 => str.ToLowerInvariant(), _ => new([char.ToLower(str[0]), .. str[1..]]) }; }