Lets say we have a namespace called AllFoos.
And Lets say all classes in the AllFoos namespace implement a specific interface called IFoo and are all singletons.
Now we have:
HashSet<IFoo> myFoos = new HashSet<IFoo>();
What would be the code to populate the collection MyFoos with the singleton instances of all the classes in AllFoos?
The singleton implementation for all of these classes is:
private static IFoo _instance = new ConcreteImplementationOfFoo1();
public static IFoo Instance
{
get
{
return _instance;
}
}