// https://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overridden public override int GetHashCode() { int hash = 13; hash = (hash * 7) + Id.GetHashCode(); hash = (hash * 7) + Name.GetHashCode(); hash = (hash * 7) + Email.GetHashCode(); hash = (hash * 7) + Password.GetHashCode(); hash = (hash * 7) + RepeatedPassword.GetHashCode(); return(hash); }
public override bool Equals(object obj) { if (!(obj is UserRegistrationModel user)) { return(false); } return(Id == user.Id && Name.Equals(user.Name) && Email.Equals(user.Email) && Password.Equals(user.Password) && RepeatedPassword.Equals(user.RepeatedPassword)); }