How can I get an instance of a static class with a string?
Example:
class Apple : IFruit
{
public static Apple GetInstance() { ... }
private Apple() { }
// other stuff
}
class Banana : IFruit
{
public static Banana GetInstance() { ... }
private Banana() { }
// other stuff
}
// Elsewhere in the code...
string fruitIWant = "Apple";
IFruit myFruitInstance = [What goes here using "fruitIWant"?].GetInstance();