System.Drawing.Color.GetHashCode C# (CSharp) Метод

GetHashCode() публичный Метод

public GetHashCode ( ) : int
Результат int
        public override int GetHashCode()
        {
            // Three cases:
            // 1. We don't have a name. All relevant data, including this fact, is in the remaining fields.
            // 2. We have a known name. The name will be the same instance of any other with the same
            // knownColor value, so we can ignore it for hashing. Note this also hashes different to
            // an unnamed color with the same ARGB value.
            // 3. Have an unknown name. Will differ from other unknown-named colors only by name, so we
            // can usefully use the names hash code alone.
            if (name != null & !IsKnownColor)
                return name.GetHashCode();

            return HashHelpers.Combine(
                HashHelpers.Combine(value.GetHashCode(), state.GetHashCode()), knownColor.GetHashCode());
        }
    }

Usage Example

Пример #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (ScreenInfo != null ? ScreenInfo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Color.GetHashCode();
         return(hashCode);
     }
 }
All Usage Examples Of System.Drawing.Color::GetHashCode