示例#1
0
文件: Altitude.cs 项目: lanicon/Styx
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="Altitude1">A altitude.</param>
        /// <param name="Altitude2">Another altitude.</param>
        /// <returns>true|false</returns>
        public static Boolean operator  >(Altitude Altitude1, Altitude Altitude2)
        {
            if ((Object)Altitude1 == null)
            {
                throw new ArgumentNullException("The given Altitude1 must not be null!");
            }

            if ((Object)Altitude2 == null)
            {
                throw new ArgumentNullException("The given Altitude2 must not be null!");
            }

            return(Altitude1.CompareTo(Altitude2) > 0);
        }
示例#2
0
文件: Altitude.cs 项目: lanicon/Styx
        /// <summary>
        /// Compares two altitudes for equality.
        /// </summary>
        /// <param name="Altitude1">A altitude.</param>
        /// <param name="Altitude2">Another altitude.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public static Boolean operator ==(Altitude Altitude1, Altitude Altitude2)
        {
            // If both are null, or both are same instance, return true.
            if (Object.ReferenceEquals(Altitude1, Altitude2))
            {
                return(true);
            }

            // If one is null, but not both, return false.
            if (((Object)Altitude1 == null) || ((Object)Altitude2 == null))
            {
                return(false);
            }

            return(Altitude1.Equals(Altitude2));
        }