private static bool Convert(QuantityClass length1, QuantityClass length) { if (length.unit != length1.unit) { throw new QMException(QMException.ExceptionEnmu.INVAILD_VALUE); } else { return(true); } }
public static bool Compare(QuantityClass length1, QuantityClass length) { try { if (Convert(length1, length)) { int variableA = (int)length.unit * length.value; int variableB = (int)length1.unit * length1.value; return(variableA == variableB); } else { throw new QMException(QMException.ExceptionEnmu.INVAILD_VALUE); } } catch (QMException e) { throw new QMException(QMException.ExceptionEnmu.INVAILD_VALUE, e.Message); } }