コード例 #1
0
ファイル: Int32.cs プロジェクト: mateoatr/runtime
        // Parses an integer from a String. Returns false rather
        // than throwing an exception if input is invalid.
        //
        public static bool TryParse([NotNullWhen(true)] string?s, out int result)
        {
            if (s == null)
            {
                result = 0;
                return(false);
            }

            return(Number.TryParseInt32IntegerStyle(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result) == Number.ParsingStatus.OK);
        }
コード例 #2
0
ファイル: Int32.cs プロジェクト: mateoatr/runtime
 public static bool TryParse(ReadOnlySpan <char> s, out int result)
 {
     return(Number.TryParseInt32IntegerStyle(s, NumberStyles.Integer, NumberFormatInfo.CurrentInfo, out result) == Number.ParsingStatus.OK);
 }