Exemple #1
0
        public static BigInteger CastBigInteger(object sourceObj)
        {
            switch (sourceObj)
            {
            case null:
                throw new ArgumentException();

            case string stringValue:
                try {
                    return(SimpleTypeParserFunctions.ParseBigInteger(stringValue));
                }
                catch (FormatException) {
                    return(default(BigInteger));
                }

            default:
                return(sourceObj.AsBigInteger());
            }
        }
Exemple #2
0
        /// <summary>
        /// Casts the object to the System.Numerics.BigInteger
        /// </summary>
        /// <param name="sourceObj">The source object</param>
        public static BigInteger?CastNullableBigInteger(object sourceObj)
        {
            switch (sourceObj)
            {
            case null:
                return(null);

            case string stringValue:
                try {
                    return(SimpleTypeParserFunctions.ParseBigInteger(stringValue));
                }
                catch (FormatException) {
                    return(default(BigInteger?));
                }

            default:
                return(sourceObj.AsBigInteger());
            }
        }