示例#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);
     }
 }
示例#2
0
        /// <summary>
        /// Returns true if Cliente instances are equal
        /// </summary>
        /// <param name="other">Instance of Cliente to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Cliente other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Nome == other.Nome ||
                     Nome != null &&
                     Nome.Equals(other.Nome)
                 ) &&
                 (
                     Idade == other.Idade ||
                     Idade != null &&
                     Idade.Equals(other.Idade)
                 ) &&
                 (
                     CadastradoEm == other.CadastradoEm ||
                     CadastradoEm != null &&
                     CadastradoEm.Equals(other.CadastradoEm)
                 ) &&
                 (
                     Cpf == other.Cpf ||
                     Cpf != null &&
                     Cpf.Equals(other.Cpf)
                 ) &&
                 (
                     Endereco == other.Endereco ||
                     Endereco != null &&
                     Endereco.Equals(other.Endereco)
                 ));
        }