Creative Use of Extension Methods

1 · Alexey Golub · Jan. 26, 2019, midnight
I’m sure everyone with at least some background in C# is aware of extension methods — a nice feature that lets developers extend existing types with new methods. This is extremely convenient in cases where you want to add functionality to types you don’t have control over. In fact, I think everyone at some point authored extensions for the base class library just to make some things more accessible. But besides the more obvious use cases, there are a few other interesting patterns that directly…...