I have a method that passes in two string objects (both numerical numbers)
and a string identifying their type.
public bool DoCompare(strin g num1, string num2, string theirType)
{
System.Type type = System.Type.Get Type(theirType) ;
return ((type)num1 <= (type)num2) ? true : false;
}
The compiler doesn't like the (type) casting that I do. What is the proper
way of casting an object to its correct type to do such a mathematical
operation?
--
Steve
and a string identifying their type.
public bool DoCompare(strin g num1, string num2, string theirType)
{
System.Type type = System.Type.Get Type(theirType) ;
return ((type)num1 <= (type)num2) ? true : false;
}
The compiler doesn't like the (type) casting that I do. What is the proper
way of casting an object to its correct type to do such a mathematical
operation?
--
Steve
Comment