NumberToUInt64() приватный статический Метод

private static NumberToUInt64 ( NumberBuffer &number, UInt64 &value ) : Boolean
number NumberBuffer
value UInt64
Результат Boolean
Пример #1
0
        internal static unsafe ulong ParseUInt64(string value, NumberStyles options, NumberFormatInfo numfmt)
        {
            byte *stackBuffer = stackalloc byte[Number.NumberBuffer.NumberBufferBytes];

            Number.NumberBuffer number = new Number.NumberBuffer(stackBuffer);
            ulong num = 0;

            Number.StringToNumber(value, options, ref number, numfmt, false);
            if ((options & NumberStyles.AllowHexSpecifier) != NumberStyles.None)
            {
                if (!Number.HexNumberToUInt64(ref number, ref num))
                {
                    throw new OverflowException(Environment.GetResourceString("Overflow_UInt64"));
                }
            }
            else if (!Number.NumberToUInt64(ref number, ref num))
            {
                throw new OverflowException(Environment.GetResourceString("Overflow_UInt64"));
            }
            return(num);
        }
Пример #2
0
        internal static unsafe bool TryParseUInt64(string s, NumberStyles style, NumberFormatInfo info, out ulong result)
        {
            byte *stackBuffer = stackalloc byte[Number.NumberBuffer.NumberBufferBytes];

            Number.NumberBuffer number = new Number.NumberBuffer(stackBuffer);
            result = 0UL;
            if (!Number.TryStringToNumber(s, style, ref number, info, false))
            {
                return(false);
            }
            if ((style & NumberStyles.AllowHexSpecifier) != NumberStyles.None)
            {
                if (!Number.HexNumberToUInt64(ref number, ref result))
                {
                    return(false);
                }
            }
            else if (!Number.NumberToUInt64(ref number, ref result))
            {
                return(false);
            }
            return(true);
        }