I'm using dependency injection in my project and wondered if it would be easier to just register all 30+ of my classes that inherit a certain interface using a for each, that way it works dynamically.
I've looked it up on Google, SO, RJ, YHA, and more Q&A sites but nothing helps. It just explains if you already have a collection of them classes, and none show you how to do it from just an interface.
For example, I need to get a list of Class1, 2 and 3, and any other clases that inherit IClass.
class Class1 : IClass {}
class Class2 : IClass {}
class Class3 : IClass {}
If I were to later on declare these, they would also be found.
class Class4 : IClass {}
class Class5 : IClass {}
class Class6 : IClass {}