コード例 #1
0
        /// <summary>
        /// Tests whether the specified object is a <see cref="CorsairColor" /> and is equivalent to this <see cref="CorsairColor" />.
        /// </summary>
        /// <param name="obj">The object to test.</param>
        /// <returns>true if <paramref name="obj" /> is a <see cref="CorsairColor" /> equivalent to this <see cref="CorsairColor" /> ; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            CorsairColor compareColor = obj as CorsairColor;

            if (ReferenceEquals(compareColor, null))
            {
                return(false);
            }

            if (ReferenceEquals(this, compareColor))
            {
                return(true);
            }

            if (GetType() != compareColor.GetType())
            {
                return(false);
            }

            return((compareColor.A == A) && (compareColor.R == R) && (compareColor.G == G) && (compareColor.B == B));
        }