loading...

How do you organize your extension methods?

github logo Updated on ・1 min read

Do you have a class library for all extension methods?
Do you copy & paste extension methods from one project to another?
Do you have different class libraries for different extended objects (like stringExtensions.dll, IComparebleExtensions.dll etc')?

Personally, I find it best to have a different dll for each assembly - so for instance I'll have a StringsExtensions class and an IComparebleExtensions class in one dll called <companyName>.System.Extensions.dll.

What do you prefer? Why do you prefer that?

twitter logo DISCUSS (1)
markdown guide
 

Where I'm at, we have a base project that is shared with other projects. That contains various things like interfaces and base classes. We just use a static class in that project for our extension methods under the project namespace. We only have a few extension methods to be fair.

Classic DEV Post from Jan 27 '19

Why do I have to use Dependency Injection in JS?

Describes how can we achieve some dependency injection pattern in JS modules and why it's useful/important.

Zohar Peled profile image
By day, try to work. By night, try to sleep.