Extension methods were introduced in C# 3.0. They are static methods that can be called as if they were instance methods on the first parameter’s type.
Why it matters
They are the mechanism that makes APIs feel natural. You can attach reusable behavior to framework types, domain models, or your own abstractions without inheritance or wrapper types.
That is one reason LINQ feels seamless: methods like Where, Select, and OrderBy are all extension methods.
Cautions
Extension methods are easy to overuse. If a helper is only relevant in one place, a normal static method may be clearer.
They also do not override instance methods. If the target type already defines a matching instance member, the instance member wins.
Adding a fluent helper to a string
Extension methods let you add reusable helpers without changing the original type.
Valid since C# 3.0
public static class StringExtensions
{
public static bool IsNullOrEmptyTrimmed(this string value) =>
string.IsNullOrWhiteSpace(value?.Trim());
}