public override bool Equals(object obj) { AccountCollection other = obj as AccountCollection; if (other == null) { return(false); } return(Equals(other)); }
public bool Equals(AccountCollection other) { if (other == null) { return(false); } if (this._dictionary == null && other._dictionary == null) { return(true); } if ((this._dictionary == null && other._dictionary != null) || (this._dictionary != null && other._dictionary == null)) { return(false); } if (this._dictionary.Count != other._dictionary.Count) { return(false); } List <string> allKeys = this._dictionary.Keys.Select(x => x).ToList(); foreach (string key in allKeys) { Account thisValue = this._dictionary[key]; if (!other._dictionary.ContainsKey(key)) { return(false); } Account otherValue = other._dictionary[key]; if (!thisValue.Equals(otherValue)) { return(false); } } return(true); }