Esempio n. 1
0
        public static ulong CastUInt64(object sourceObj)
        {
            switch (sourceObj)
            {
            case null:
                throw new ArgumentException();

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

            default:
                return(sourceObj.AsUInt64());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Casts the object to the System.UInt64
        /// </summary>
        /// <param name="sourceObj">The source object</param>
        public static ulong?CastNullableUInt64(object sourceObj)
        {
            switch (sourceObj)
            {
            case null:
                return(null);

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

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