public bool Equals(CashEntry other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Denomination.Equals(other.Denomination)); }
public override int GetHashCode() => Denomination != null?Denomination.GetHashCode() : 0;
public CashEntry(Denomination denomination, int quantity) { Denomination = denomination ?? throw new ArgumentNullException($"{nameof(denomination)} cannot be null"); Quantity = quantity >= 0 ? quantity : throw new ArgumentException($"{nameof(quantity)} cannot be less than zero"); }