System.Number.TryParseUInt64 C# (CSharp) Method

TryParseUInt64() static private method

static private TryParseUInt64 ( String s, NumberStyles style, NumberFormatInfo info, UInt64 &result ) : Boolean
s String
style NumberStyles
info NumberFormatInfo
result UInt64
return Boolean
        internal unsafe static Boolean TryParseUInt64(String s, NumberStyles style, NumberFormatInfo info, out UInt64 result) {

            Byte * numberBufferBytes = stackalloc Byte[NumberBuffer.NumberBufferBytes];
            NumberBuffer number = new NumberBuffer(numberBufferBytes);
            result = 0;
    
            if (!TryStringToNumber(s, style, ref number, info, false)) {
                return false;
            }

            if ((style & NumberStyles.AllowHexSpecifier) != 0) {
                if (!HexNumberToUInt64(ref number, ref result)) { 
                    return false;
                }
            }
            else {
                if (!NumberToUInt64(ref number, ref result)) {
                    return false;
                }
            }
            return true;           
        }

Usage Example

示例#1
0
        public static bool TryParse(string?s, out ulong result)
        {
            if (s == null)
            {
                result = 0;
                return(false);
            }

            return(Number.TryParseUInt64(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result));
        }
All Usage Examples Of System.Number::TryParseUInt64