/// <summary> /// Compare this MO to another MO /// </summary> /// <exception cref="T:System.ArgumentException">If the currencies of both MO instances don't match</exception> public int CompareTo(MO other) { if (other == null || other.IsNull) { return(1); } else if (this.IsNull && !other.IsNull) { return(-1); } else if (this.Value.HasValue && !other.Value.HasValue) { return(1); } else if (other.Value.HasValue && !this.Value.HasValue) { return(-1); } else if (!other.Value.HasValue && !this.Value.HasValue) { return(0); } else if (!this.Currency.Equals(other.Currency)) { throw new ArgumentException("Currencies must match to compare MO"); } else { return(this.Value.Value.CompareTo(other.Value.Value)); } }
/// <summary> /// Determine if this MO is equal to another MO /// </summary> public bool Equals(MO other) { bool result = false; if (other != null) { result = base.Equals((QTY <Nullable <Decimal> >)other) && this.Currency == other.Currency && this.Precision == other.Precision; } return(result); }