CoerceTypes() public static method

Coerces the types so they can be compared.
public static CoerceTypes ( object &m, object &n ) : void
m object The right.
n object The left.
return void
Ejemplo n.º 1
0
        public void CoercesTypes()
        {
            object x = (int)1;
            object y = (double)2;

            NumberUtils.CoerceTypes(ref x, ref y);
            Assert.AreEqual(typeof(double), x.GetType());
        }
Ejemplo n.º 2
0
 private static bool CoerceTypes(ref object left, ref object right)
 {
     if (NumberUtils.IsNumber(left) && NumberUtils.IsNumber(right))
     {
         NumberUtils.CoerceTypes(ref right, ref left);
         return(true);
     }
     return(false);
 }