示例#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 = Size.GetHashCode();
         hashCode = (hashCode * 397) ^ MaxSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (RestrictedSizes?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)ResizeMode;
         hashCode = (hashCode * 397) ^ (int)AnchorPosition;
         hashCode = (hashCode * 397) ^ Upscale.GetHashCode();
         hashCode = (hashCode * 397) ^ (CenterCoordinates?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ AnchorPoint.GetHashCode();
         return(hashCode);
     }
 }
示例#2
0
        /// <summary>
        /// Returns a value that indicates whether the specified object is an
        /// <see cref="ResizeLayer"/> object that is equivalent to
        /// this <see cref="ResizeLayer"/> object.
        /// </summary>
        /// <param name="obj">
        /// The object to test.
        /// </param>
        /// <returns>
        /// True if the given object  is an <see cref="ResizeLayer"/> object that is equivalent to
        /// this <see cref="ResizeLayer"/> object; otherwise, false.
        /// </returns>
        public override bool Equals(object obj)
        {
            var resizeLayer = obj as ResizeLayer;

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

            return(Size == resizeLayer.Size &&
                   ResizeMode == resizeLayer.ResizeMode &&
                   AnchorPosition == resizeLayer.AnchorPosition &&
                   Upscale == resizeLayer.Upscale &&
                   ((CenterCoordinates != null &&
                     resizeLayer.CenterCoordinates != null &&
                     CenterCoordinates.SequenceEqual(resizeLayer.CenterCoordinates)) ||
                    (CenterCoordinates == resizeLayer.CenterCoordinates)) &&
                   MaxSize == resizeLayer.MaxSize &&
                   ((RestrictedSizes != null &&
                     resizeLayer.RestrictedSizes != null &&
                     RestrictedSizes.SequenceEqual(resizeLayer.RestrictedSizes)) ||
                    (RestrictedSizes == resizeLayer.RestrictedSizes)) &&
                   AnchorPoint == resizeLayer.AnchorPoint);
        }