System.Data.SqlTypes.SqlMoney.CompareTo C# (CSharp) Метод

CompareTo() публичный Метод

public CompareTo ( SqlMoney value ) : int
value SqlMoney
Результат int
        public int CompareTo(SqlMoney value)
        {
            // If both Null, consider them equal.
            // Otherwise, Null is less than anything.
            if (IsNull)
                return value.IsNull ? 0 : -1;
            else if (value.IsNull)
                return 1;

            if (this < value) return -1;
            if (this > value) return 1;
            return 0;
        }

Same methods

SqlMoney::CompareTo ( object value ) : int

Usage Example

Пример #1
0
        /**
         * Compares two instances of SqlMoney to determine if the first is less than the second.
         * @param x A SqlMoney instance
         * @param y A SqlMoney instance
         * @return A SqlBoolean that is True if the first instance is less than the second instance, otherwise False.
         * If either instance of SqlDouble is null, the Value of the SqlBoolean will be Null.
         */
        public static SqlBoolean LessThanOrEqual(SqlMoney x, SqlMoney y)
        {
            if (x.IsNull || y.IsNull)
            {
                return(SqlBoolean.Null);
            }

            if (x.CompareTo(y) <= 0)
            {
                return(SqlBoolean.True);
            }

            return(SqlBoolean.False);
        }
All Usage Examples Of System.Data.SqlTypes.SqlMoney::CompareTo