I am sure this should be easy, perhaps I am missing something obvious. I have a bunch of classes that implement the IClass interface. At runtime I want to use the MEF DirectoryCatalog to retrieve references all those classes implementing that IClass interface. So, at this point I have some kind of pool of classes that can be instantiated.
Now, from this point on I want to be able to instantiate one or many of these classes based upon whatever business logic is executing at the time. So I have managed to get the DirectoryCatalog working fine. I have also managed to implement an ImportMany so that a collection of those classes implementing the IClass interface exist.
This would be fine, but I don't want to simply have a collection of all classes and I may want to be able to instantiate more than one version of that class at any time. I started looking at using Lazy, but I assume this would simply assist with when the class is instantiated, not how many.
Again, I can't help but think I am missing something obvious. Any assistance would be most grateful.
Thanks