/// <summary> /// Generate HashCode using same fields used for Equals /// </summary> /// <returns></returns> public override int GetHashCode() { return (Id.GetHashCode() + Status.GetHashCode() + Guess.GetHashCode() + Renderings.GetHashCode() + Notes.GetHashCode() + Denials.ToString().GetHashCode()); }
public override bool Equals(object obj) { TermRendering other2 = obj as TermRendering; if (other2 == null) { return(base.Equals(obj)); } return (Id == other2.Id && Status == other2.Status && Guess == other2.Guess && Renderings == other2.Renderings && Notes == other2.Notes && Denials.ToString() == other2.Denials.ToString()); }
public void MergeDenials(TermRendering parent, TermRendering theirs) { if (parent != null && Denials.SequenceEqual(parent.Denials)) // I didn't change, take the theirs { Denials = new List <string>(theirs.Denials); return; } if (parent != null && theirs.Denials.SequenceEqual(parent.Denials)) // They didn't change either, nothing to do { return; } foreach (var denial in theirs.Denials) { if (!Denials.Contains(denial)) { Denials.Add(denial); } } Denials.Sort(); }