thomas10001 Posted July 10, 2003 Posted July 10, 2003 Is there possible to do something like this to instansiate objects dynamically? Say I have a class MyClass with constructor MyClass() It could be an unlimited different classes I want to create so just doing a simple switch case would not work. I would like to instansiate MyClass with say just only knowing the name of the class as a string, classString = "MyClass"; or providing any other information in order to create the class Is there a way to make a method which instansiate the object public Object createClass(classString) { // code to create the class, How to do that??? } The reason is becasue this createClass will be in a base class which will not know what class types are able to create. Quote
*Gurus* divil Posted July 10, 2003 *Gurus* Posted July 10, 2003 See Activator.CreateInstance() Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.