public override bool Equals(object obj) { var query = obj as Query; if (query == null) { return(false); } if (Constraint1 != null && Constraint2 != null) { return(Constraint1.Equals(query.Constraint1) && Constraint2.Equals(query.Constraint2)); } if (Constraint1 == null) { return(Constraint2.Equals(query.Constraint2)); } if (Constraint2 == null) { return(Constraint1.Equals(query.Constraint1)); } throw new Exception("Cannot reach here"); }
public override int GetHashCode() { if (Constraint1 != null && Constraint2 != null) { return(Constraint1.GetHashCode() ^ Constraint2.GetHashCode()); } if (Constraint1 == null) { return(Constraint2.GetHashCode()); } if (Constraint2 == null) { return(Constraint1.GetHashCode()); } throw new Exception("Cannot reach here"); }