L
Locia
I would like compare all type.
I try with this function but I get System.NullReference.Exception if
pass in Compare function two int type.
Why relational operation isn't defined for basic type as int?
How can I do?
private bool Compare(Object leftOperand,String op,Object rightOperand)
{
if (op.Equals(">"))
{
Type typeObject=leftOperand.GetType();
MethodInfo method = typeObject.GetMethod
("op_GreaterThan",BindingFlags.Public | BindingFlags.Static);
bool result=(bool) method.Invoke(leftOperand,objParam);
return result;
}
}
I try with this function but I get System.NullReference.Exception if
pass in Compare function two int type.
Why relational operation isn't defined for basic type as int?
How can I do?
private bool Compare(Object leftOperand,String op,Object rightOperand)
{
if (op.Equals(">"))
{
Type typeObject=leftOperand.GetType();
MethodInfo method = typeObject.GetMethod
("op_GreaterThan",BindingFlags.Public | BindingFlags.Static);
bool result=(bool) method.Invoke(leftOperand,objParam);
return result;
}
}