I am not a fan of doing TypeNameExtensions
. It omits why you are extending the type. I understand it is uniform, and thus requires little thought, but also provides little information.
It makes one bucket for every extension to that type. If you have two features that are completely unrelated, should they be organized together just because they extend the same type? You end up with large, incohesive static classes that change with every new feature. SRP and OCP go out the window.
I like to name my extension classes after the feature they are enabling. For example, I have extension methods FormatCurrent
and FormatInvariant
on string
which help with globalized code. They are declared on the GlobalizedFormatting
static class. No matter how many other extensions are added or removed from string
, this class doesn't have to be touched because it is organized by feature.
My exception is for classes which create a functional API, such as Enumerable
and Queryable
. Naming them after the feature's core interface seems clean.