C# › Extension Methods

Why can't extension methods be used to add STATIC members, operators, or FIELDS to an existing type, and what are the practical implications of this limitation?

Advanced

Answer

Extension methods only extend the set of callable INSTANCE methods available on a type through syntactic sugar — they can't add actual state (fields), can't participate in operator overloading, and can't extend static method call syntax on the type itself, because none of these actually modify the type's real metadata; the extended type genuinely gains nothing at the runtime/reflection level.
public static class StringExtensions {
  // public static string EmptyValue = ""; // Error: can't add a static field this way
  // public static string operator +(string a, string b) => a + b; // Error: extension methods can't define operators
}
Real-world example Understanding why you must use inheritance, composition, or a wrapper type instead of extension methods when you genuinely need to add state to a type.

Common follow-ups: What alternative approaches exist when you need to attach genuinely new STATE to instances of an existing type you don't own?