Create New instance of a class, but use a variable value as name..Possible?
And yes, I've searched everywhere, but haven't found any useful.
So i'll start by asking here.
example code..
Error message:
A local variable named 'className' cannot be declared in this scope because it would give a different meaning to 'className', which is already used in a 'parent or current' scope to denote something else
namespace IsThisPossible
{
class Program
{
static void Main(string[] args)
{
string name = "olaf";
newClass(name);
}
static void newClass(string className)
{
Stuff className = new Stuff();
}
}
class Stuff
{
}
}