/// <summary>
        /// Tries to parse a 64-bit unsigned integer from a string. This method should handle hexadecimal values
        /// as well as normal values.
        /// </summary>
        /// <param name="value">The string value to parse.</param>
        /// <param name="result">The parsed integer, if the string was valid. If invalid, this
        /// will be the default integer value.</param>
        /// <returns>True if the conversion was successful; otherwise returns false.</returns>
        public static bool TryParseEx(string value, out ulong result)
        {
            bool canConvert = true;

            try
            {
                var converter = new UInt64Converter();
                result = (ulong)converter.ConvertFromString(value);
            }
            catch (Exception)
            {
                result     = default(ulong);
                canConvert = false;
            }

            return(canConvert);
        }
Exemplo n.º 2
0
 static ulong ParseUInt64(Token token)
 {
     return((ulong)uint64Converter.ConvertFromString(token.Image));
 }