Пример #1
0
        /// <summary>
        /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public int CompareTo(object value)
        {
            DevicePortNumber dps = value as DevicePortNumber;

            if (object.ReferenceEquals(dps, null))
            {
                return(1);
            }

            return(Number.CompareTo(dps.Number));
        }
Пример #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)
        {
            DevicePortNumber dpn = obj as DevicePortNumber;

            if (object.ReferenceEquals(dpn, null))
            {
                return(false);
            }

            return(this.Number == dpn.Number);
        }