Create an instance of a class from a string
Is there a way to create an instance of a class based on the fact I know the name of the class at runtime. Basically I would have the name of the class in a string. 8 Answers 8
Is there a way to create an instance of a class based on the fact I know the name of the class at runtime. Basically I would have the name of the class in a string. 8 Answers 8
Seeing as C# can’t switch on a Type (which I gather wasn’t added as a special case because is relationships mean that more than one distinct case might apply), is there a better way to simulate switching on type other than this? void Foo(object o) { if (o is A) { ((A)o).Hop(); } else if … Read more