public override int GetHashCode() { unchecked { var hashCode = Id; hashCode = (hashCode * 397) ^ (QuestionText != null ? QuestionText.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Type.GetHashCode(); hashCode = (hashCode * 397) ^ Position; hashCode = (hashCode * 397) ^ (QuestionId.HasValue ? QuestionId.Value : 0); hashCode = (hashCode * 397) ^ (ExPossibleAnswers != null ? ExPossibleAnswers.GetHashCode() : 0); return(hashCode); } }
public bool Equals(ExQuestion other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } var returned = Id == other.Id && QuestionText == other.QuestionText && Type == other.Type && Position == other.Position && QuestionId == other.QuestionId; return(ExPossibleAnswers.Aggregate(returned, (current, answer) => current && other.ExPossibleAnswers.Contains(answer))); }