NumberBufferToDecimal() private method

private NumberBufferToDecimal ( byte number, Decimal &value ) : Boolean
number byte
value Decimal
return Boolean
Ejemplo n.º 1
0
        internal static unsafe Decimal ParseDecimal(string value, NumberStyles options, NumberFormatInfo numfmt)
        {
            byte *stackBuffer = stackalloc byte[Number.NumberBuffer.NumberBufferBytes];

            Number.NumberBuffer number = new Number.NumberBuffer(stackBuffer);
            Decimal             num    = new Decimal();

            Number.StringToNumber(value, options, ref number, numfmt, true);
            if (!Number.NumberBufferToDecimal(number.PackForNative(), ref num))
            {
                throw new OverflowException(Environment.GetResourceString("Overflow_Decimal"));
            }
            return(num);
        }
Ejemplo n.º 2
0
        internal unsafe static decimal ParseDecimal(string value, NumberStyles options, NumberFormatInfo numfmt)
        {
            byte *stackBuffer = stackalloc byte[checked (unchecked ((UIntPtr)Number.NumberBuffer.NumberBufferBytes) * 1)];

            Number.NumberBuffer numberBuffer = new Number.NumberBuffer(stackBuffer);
            decimal             result       = 0m;

            Number.StringToNumber(value, options, ref numberBuffer, numfmt, true);
            if (!Number.NumberBufferToDecimal(numberBuffer.PackForNative(), ref result))
            {
                throw new OverflowException(Environment.GetResourceString("Overflow_Decimal"));
            }
            return(result);
        }
Ejemplo n.º 3
0
        internal static unsafe bool TryParseDecimal(string value, NumberStyles options, NumberFormatInfo numfmt, out Decimal result)
        {
            byte *stackBuffer = stackalloc byte[Number.NumberBuffer.NumberBufferBytes];

            Number.NumberBuffer number = new Number.NumberBuffer(stackBuffer);
            result = new Decimal();
            return(Number.TryStringToNumber(value, options, ref number, numfmt, true) && Number.NumberBufferToDecimal(number.PackForNative(), ref result));
        }
Ejemplo n.º 4
0
        internal unsafe static bool TryParseDecimal(string value, NumberStyles options, NumberFormatInfo numfmt, out decimal result)
        {
            byte *stackBuffer = stackalloc byte[checked (unchecked ((UIntPtr)Number.NumberBuffer.NumberBufferBytes) * 1)];

            Number.NumberBuffer numberBuffer = new Number.NumberBuffer(stackBuffer);
            result = 0m;
            return(Number.TryStringToNumber(value, options, ref numberBuffer, numfmt, true) && Number.NumberBufferToDecimal(numberBuffer.PackForNative(), ref result));
        }