Bad experience with extension methods

by Marius Gheorghe 12. July 2010 16:29

Had some bad experience with a OSS library in the context of extension methods. 2 rules were broken:

- the logic of a very important type in that library was implemented with extension methods.

- the extension methods were declared in DIFFERENT namespaces (!!!).

 

That, frankly, is just dumb. Extension methods are used for extending types for which you don’t have the code. Even if you break this rule remember to put the extension method in the same namespace of the extended type so that when somebody is importing the namespace of that type it has access to ALL extension methods automatically.

Tags:

dotNET


marius gheorghe

developer, dad, gamer

Contact me

My Resume

Favourite Tools