示例#1
0
        /// <summary>
        /// Equality function
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public bool Equals(LowLevelPoint p)
        {
            // If parameter is null return false:
            if ((object)p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return((x == p.x) && (y == p.y));
        }
示例#2
0
#pragma warning restore 1591
        /// <summary>
        /// Equals override
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }
#pragma warning disable 168
            var p = new LowLevelPoint();
            try {
                p = (LowLevelPoint)obj;
            }
            catch (InvalidCastException) {
                return(false);
            }
#pragma warning restore 168

            // Return true if the fields match:
            return((x == p.x) && (y == p.y));
        }