G
Guest
I have a custom class that has been assigned to a variable and worked with, I
now need to cast this class as a different class, which is in a separate
assembly, not currently in the project. Normally if it was part of the
project I would say:
MyNewClass newClassObject = (MyNewClass) currentClassObject;
I have the name of the class, assembly and namespace in separate variables.
I even have a variable of ‘Type’ that is equal to ‘MyNewClass’ (from below
code)
string stuffToLoad = myNameSpace + "." + myClass + ", " + myAssembly;
Type myType = Type.GetType(stuffToLoad, true);
My problem is that I need to recast currentClassObject into MyNewClass and
I seem to have run out of options. Have tried several roads already. Anyone
have any ideas?
-phil
now need to cast this class as a different class, which is in a separate
assembly, not currently in the project. Normally if it was part of the
project I would say:
MyNewClass newClassObject = (MyNewClass) currentClassObject;
I have the name of the class, assembly and namespace in separate variables.
I even have a variable of ‘Type’ that is equal to ‘MyNewClass’ (from below
code)
string stuffToLoad = myNameSpace + "." + myClass + ", " + myAssembly;
Type myType = Type.GetType(stuffToLoad, true);
My problem is that I need to recast currentClassObject into MyNewClass and
I seem to have run out of options. Have tried several roads already. Anyone
have any ideas?
-phil