public override bool Equals(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } if (!(obj is TaxSummary)) { return(false); } TaxSummary e = (TaxSummary)obj; return(this.TaxCode == e.TaxCode && this.TaxAmount == e.TaxAmount); }
private TaxSummary GetTaxSummary(string taxCode) { if (_taxes.ContainsKey(taxCode)) return _taxes[taxCode]; TaxSummary taxSummary = new TaxSummary { TaxCode = taxCode, TaxAmount =0 }; _taxes.Add(taxCode, taxSummary); return taxSummary; }