Exemplo n.º 1
0
 /// <summary>
 /// Override of the <see cref="Object.GetHashCode"/> Method.
 /// </summary>
 /// <returns>A Hash-Code suitable for use in hashtables.</returns>
 /// <remarks>Only considers the First, Middle, and Last names; ignores other fields.</remarks>
 public override int GetHashCode()
 {
     unchecked {
         int hash = 17;
         hash = hash * 23 + (First.HasValue() ? First.GetHashCode() : 0);
         hash = hash * 23 + (Last.HasValue() ? Last.GetHashCode() : 0);
         hash = hash * 23 + (Middle.HasValue() ? Middle.GetHashCode() : 0);
         return(hash);
     }
 }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         // Maybe nullity checks, if these are objects not primitives!
         hash = hash * 17 + First.GetHashCode();
         hash = hash * 17 + Middle.GetHashCode();
         hash = hash * 17 + Last.GetHashCode();
         return(hash);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Serves as a hash function for a particular type.
        /// </summary>
        /// <returns>
        /// A hash code for the current <see cref="T:System.Object"/>.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override int GetHashCode()
        {
            unchecked
            {
                int result = Prefix != null?Prefix.GetHashCode() : 0;

                result = (result * 397) ^ (First != null ? First.GetHashCode() : 0);
                result = (result * 397) ^ (Middle != null ? Middle.GetHashCode() : 0);
                result = (result * 397) ^ (Last != null ? Last.GetHashCode() : 0);
                result = (result * 397) ^ (Suffix != null ? Suffix.GetHashCode() : 0);
                return(result);
            }
        }