// awesome-humans/dotnet template | targets: net11.0, csharp-15 | last-reviewed: 2026-11-14 | sources: dotnet-blog, ms-learn // Belongs to Example.Library. Library surface example: C# 14 extension members (opinions/csharp.md). namespace Example.Library; public static class TextExtensions { extension(string text) { /// States a fact about the instance, which makes it a property. public bool IsBlank => string.IsNullOrWhiteSpace(text); /// Transforms the text using an argument, which makes it a method. public string Truncate(int maxLength) { ArgumentNullException.ThrowIfNull(text); ArgumentOutOfRangeException.ThrowIfNegative(maxLength); return text.Length <= maxLength ? text : text[..maxLength]; } } }