H
hdjim
Hello, I'm trying to use the type returned by GetType as the declared
type of a variable but can't seem to get it working. Would appreciate
any help
Here is the code:
//gets loaded from db on startup
string Model = "ZZZ";
string sBase = "Base";
string state = "VA";
Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
string baseType = Model + "." + sBase + "." + "Manager";
Type BaseObjType = assembly.GetType(baseType);
I now want to use BaseObjType as the declared type like so
(BaseObjType) myType;
But the above does not work. How to use the return type from GetType()
as the reference type of a variable?
TIA
hd
type of a variable but can't seem to get it working. Would appreciate
any help
Here is the code:
//gets loaded from db on startup
string Model = "ZZZ";
string sBase = "Base";
string state = "VA";
Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
string baseType = Model + "." + sBase + "." + "Manager";
Type BaseObjType = assembly.GetType(baseType);
I now want to use BaseObjType as the declared type like so
(BaseObjType) myType;
But the above does not work. How to use the return type from GetType()
as the reference type of a variable?
TIA
hd