Esempio n. 1
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>
 /// A 32-bit signed integer that is the hash code for this instance.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MimeType.GetHashCode();
         hashCode = (hashCode * 397) ^ IsIndexed.GetHashCode();
         hashCode = (hashCode * 397) ^ Quality;
         return(hashCode);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            var format = obj as ISupportedImageFormat;

            if (format == null)
            {
                return(false);
            }

            return(MimeType.Equals(format.MimeType) && IsIndexed.Equals(format.IsIndexed));
        }
Esempio 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>
 public override int GetHashCode()
 {
     unchecked {
         int result = (PropertyName != null ? PropertyName.GetHashCode() : 0);
         result = (result * 397) ^ (PropertyType != null ? PropertyType.GetHashCode() : 0);
         result = (result * 397) ^ (PropertyComponentType != null ? PropertyComponentType.GetHashCode() : 0);
         result = (result * 397) ^ RequiresIndex.GetHashCode();
         result = (result * 397) ^ RequiresMapKey.GetHashCode();
         result = (result * 397) ^ IsIndexed.GetHashCode();
         result = (result * 397) ^ IsMapped.GetHashCode();
         result = (result * 397) ^ IsFragment.GetHashCode();
         return(result);
     }
 }
Esempio n. 4
0
        //public static implicit operator int(ColorFormat mode)
        //{
        //    return mode.BitsPerPixel;
        //}

        /// <summary>
        /// Compares two instances.
        /// </summary>
        /// <param name="other">The other instance.</param>
        /// <returns>
        /// Zero if this instance is equal to other;
        /// a positive value  if this instance is greater than other;
        /// a negative value otherwise.
        /// </returns>
        public int CompareTo(ColorFormat other)
        {
            int result = BitsPerPixel.CompareTo(other.BitsPerPixel);

            if (result != 0)
            {
                return(result);
            }
            result = IsIndexed.CompareTo(other.IsIndexed);
            if (result != 0)
            {
                return(result);
            }
            result = Alpha.CompareTo(other.Alpha);
            return(result);
        }
 public override int GetHashCode()
 {
     return(IsCascadeDelete.GetHashCode() + IsIndexed.GetHashCode());
 }
Esempio n. 6
0
 public override int GetHashCode()
 {
     unchecked {
         return(IsIndexed.GetHashCode() ^ Info.GetHashCode() ^ Alpha.GetHashCode());
     }
 }