System.Number.ParseDecimal C# (CSharp) Method

ParseDecimal() static private method

static private ParseDecimal ( String value, NumberStyles options, NumberFormatInfo numfmt ) : Decimal
value String
options NumberStyles
numfmt NumberFormatInfo
return Decimal
        internal unsafe static Decimal ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt) {

            Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes];
            NumberBuffer number = new NumberBuffer(numberBufferBytes);
            Decimal result = 0;
                        
            StringToNumber(value, options, ref number, numfmt, true);

            if (!NumberBufferToDecimal(number.PackForNative(), ref result)) {
                throw new OverflowException(Environment.GetResourceString("Overflow_Decimal"));
            }
            return result;
        }

Usage Example

示例#1
0
文件: Decimal.cs 项目: chcosta/corert
 public static Decimal Parse(String s, NumberStyles style, IFormatProvider provider)
 {
     ValidateParseStyleFloatingPoint(style);
     if (s == null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
     }
     return(Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider)));
 }
All Usage Examples Of System.Number::ParseDecimal