clojure.lang.Numbers.ToBigDecimal C# (CSharp) Метод

ToBigDecimal() приватный Метод

private ToBigDecimal ( object x ) : BigDecimal
x object
Результат BigDecimal
        static BigDecimal ToBigDecimal(object x)
        {
            BigDecimal bigDec = x as BigDecimal;
            if (bigDec != null)
                return bigDec;

            BigInt bigInt = x as BigInt;
            if (bigInt != null)
            {
                if (bigInt.Bipart == null)
                    return BigDecimal.Create(bigInt.Lpart);
                else
                    return BigDecimal.Create(bigInt.Bipart);
            }

            BigInteger bigInteger = x as BigInteger;
            if (bigInteger != null)
                return BigDecimal.Create(bigInteger);

            if (x is double)
                return BigDecimal.Create((double)x);

            if (x is float)
                return BigDecimal.Create((double)(float)x);

            Ratio r = x as Ratio;
            if ( r != null )
                return (BigDecimal)divide(BigDecimal.Create(r.numerator), r.denominator);

            return BigDecimal.Create(Util.ConvertToLong(x));
        }