Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi all

i need to create a C# class object in runtime (dynamically)

my class name is in a string variable

 

this is a web application developed in ASP.NET and C#

 

if any body have an idea pls help

thanks in advance

  • Administrators
Posted (edited)

Quick example....

object o;

o = Activator.CreateInstance(Type.GetType("System.DateTime"));

however note that because I've declared the variable as object I have no access to the members of DateTime.

Could you give a bit more detail on what you are trying to do as there may be a better / easier way.

Edited by PlausiblyDamp

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

hi PlausiblyDamp

thank you very much

i have changed it according to my situation and now it's working fine

thanks again

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...