Пример #1
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Width.GetHashCode();
         hashCode = (hashCode * 397) ^ Height.GetHashCode();
         hashCode = (hashCode * 397) ^ MinWidth.GetHashCode();
         hashCode = (hashCode * 397) ^ MinHeight.GetHashCode();
         return(hashCode);
     }
 }
Пример #2
0
 /// <summary>
 /// Returns the object's hash code.
 /// </summary>
 /// <returns>Hash code.</returns>
 public override int GetHashCode()
 {
     // See http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + PadChar.GetHashCode();
         hash = hash * 23 + Alignment.GetHashCode();
         hash = hash * 23 + MinWidth.GetHashCode();
         hash = hash * 23 + MaxWidth.GetHashCode();
         return(hash);
     }
 }