D
DotNetJunkies User
Hi,
Does anyone know how/if you can instantiate a C# reference type object dynamically? More specifically, my project has a number of classes that I've created and in some cases it would be very handy to be able to instantiate them based on a string variable representing their class name.
Here's an example of what I'd be looking to do.
public object DynamicInstantiation(string className)
{
return new [dynamic intantiation sytax here using className varibable value];
}
I rember doing something like this once in a Java class long ago and I figured that since C# has so many similarities that there must be a way but I've not been able to find a working example in any MS documentation.
Any help would be much appreciated!
Does anyone know how/if you can instantiate a C# reference type object dynamically? More specifically, my project has a number of classes that I've created and in some cases it would be very handy to be able to instantiate them based on a string variable representing their class name.
Here's an example of what I'd be looking to do.
public object DynamicInstantiation(string className)
{
return new [dynamic intantiation sytax here using className varibable value];
}
I rember doing something like this once in a Java class long ago and I figured that since C# has so many similarities that there must be a way but I've not been able to find a working example in any MS documentation.
Any help would be much appreciated!