G
Guest
Can someone explain how to cast an object to a specific type during runtime?
// This line of code tells me the objects type.
System.Type type = System.Type.GetType("string of the type");
// This line of code compares the objects, but the compiler doesn't like my
casting.
return ((type)object1 <= (type)object2) ? true : false;
The compiler doesn't like my casting of (type)object1 or (type)object2.
Steve
// This line of code tells me the objects type.
System.Type type = System.Type.GetType("string of the type");
// This line of code compares the objects, but the compiler doesn't like my
casting.
return ((type)object1 <= (type)object2) ? true : false;
The compiler doesn't like my casting of (type)object1 or (type)object2.
Steve