Why C# Keeps Opening Its Syntax (And Why It Matters)
Conclusion C# has been evolving in a very specific direction: 👉 It is gradually giving language-level privileges to user-defined types. This is not accidental. This article explains why. C# has be...

Source: DEV Community
Conclusion C# has been evolving in a very specific direction: 👉 It is gradually giving language-level privileges to user-defined types. This is not accidental. This article explains why. C# has been evolving in a very specific direction: Language-level privileges are gradually being opened to user-defined types. This article explains that evolution and why it naturally leads to the idea of giving meaning to values themselves. Early C#: Permission by Type In early C#, language constructs were tightly bound to specific types. foreach (var item in collection) { } This required IEnumerable. This construct only works if your type implements this interface. Modern C#: Pattern-Based Today, it's different. public class MyCollection { public Enumerator GetEnumerator() => new Enumerator(); public struct Enumerator { public int Current => 0; public bool MoveNext() => false; } } The compiler now cares about behavior, not type. This Pattern Repeats using → Dispose() await → GetAwaiter() d