Exemple #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Nome != null)
         {
             hashCode = hashCode * 59 + Nome.GetHashCode();
         }
         if (Idade != null)
         {
             hashCode = hashCode * 59 + Idade.GetHashCode();
         }
         if (CadastradoEm != null)
         {
             hashCode = hashCode * 59 + CadastradoEm.GetHashCode();
         }
         if (Cpf != null)
         {
             hashCode = hashCode * 59 + Cpf.GetHashCode();
         }
         if (Endereco != null)
         {
             hashCode = hashCode * 59 + Endereco.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemple #2
0
        public void Verifica_Hash()
        {
            const int hashNaoHash = 1;
            var       cpf         = new Cpf("123456789-20");

            Assert.AreEqual(cpf.GetHashCode(), hashNaoHash);
        }
Exemple #3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Titular != null)
         {
             hashCode = hashCode * 59 + Titular.GetHashCode();
         }
         if (Cpf != null)
         {
             hashCode = hashCode * 59 + Cpf.GetHashCode();
         }
         if (Senha != null)
         {
             hashCode = hashCode * 59 + Senha.GetHashCode();
         }
         if (Conta != null)
         {
             hashCode = hashCode * 59 + Conta.GetHashCode();
         }
         return(hashCode);
     }
 }
 public override int GetHashCode()
 {
     return(Name.GetHashCode() ^ Email.GetHashCode() ^ Cpf.GetHashCode() ^ Phone.GetHashCode() ^ Account.GetHashCode() ^ Address.GetHashCode());
 }
Exemple #5
0
 public override int GetHashCode()
 {
     return(Cpf.GetHashCode());
 }