Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...