System.Number.ParseInt64 C# (CSharp) Method

ParseInt64() static private method

static private ParseInt64 ( String value, NumberStyles options, NumberFormatInfo numfmt ) : Int64
value String
options NumberStyles
numfmt NumberFormatInfo
return Int64
        internal unsafe static Int64 ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt) {
            Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes];
            NumberBuffer number = new NumberBuffer(numberBufferBytes);
            Int64 i = 0;

            StringToNumber(value, options, ref number, numfmt, false);

            if ((options & NumberStyles.AllowHexSpecifier) != 0) {
                if (!HexNumberToInt64(ref number, ref i)) {
                    throw new OverflowException(Environment.GetResourceString("Overflow_Int64"));
                }
            }
            else {
                if (!NumberToInt64(ref number, ref i)) {
                    throw new OverflowException(Environment.GetResourceString("Overflow_Int64"));
                }
            }
            return i;
        }

Usage Example

示例#1
0
        // Parses a long from a String in the given style.  If
        // a NumberFormatInfo isn't specified, the current culture's
        // NumberFormatInfo is assumed.
        //
        /// <include file='doc\Int64.uex' path='docs/doc[@for="Int64.Parse3"]/*' />
        public static long Parse(String s, NumberStyles style, IFormatProvider provider)
        {
            NumberFormatInfo info = NumberFormatInfo.GetInstance(provider);

            NumberFormatInfo.ValidateParseStyle(style);
            return(Number.ParseInt64(s, style, info));
        }
All Usage Examples Of System.Number::ParseInt64