B
blue
I have a class called "MyClass". At runtime, I don't know that the class is
of type MyClass but I do know the string name of the class. Is there a way
to create an instance of a class when I only know it's name?
I was looking at:
Type myType1 = Type.GetType("System.Int32");
myType1 = 10; // error because myType is of type Type, not System.Int32
myType1.ToString(); // prints out "System.Int32"
I need to have an instance of my object and call its methods, not an
instance of Type.
Any help will be much appreciated.
Thanks.
of type MyClass but I do know the string name of the class. Is there a way
to create an instance of a class when I only know it's name?
I was looking at:
Type myType1 = Type.GetType("System.Int32");
myType1 = 10; // error because myType is of type Type, not System.Int32
myType1.ToString(); // prints out "System.Int32"
I need to have an instance of my object and call its methods, not an
instance of Type.
Any help will be much appreciated.
Thanks.