예제 #1
0
        public static void Parse_Valid(string value, NumberStyles style, IFormatProvider provider, UIntPtr expected)
        {
            UIntPtr result;

            // Default style and provider
            if (style == NumberStyles.Integer && provider == null)
            {
                Assert.True(UIntPtr.TryParse(value, out result));
                Assert.Equal(expected, result);
                Assert.Equal(expected, UIntPtr.Parse(value));
            }

            // Default provider
            if (provider == null)
            {
                Assert.Equal(expected, UIntPtr.Parse(value, style));

                // Substitute default NumberFormatInfo
                Assert.True(UIntPtr.TryParse(value, style, new NumberFormatInfo(), out result));
                Assert.Equal(expected, result);
                Assert.Equal(expected, UIntPtr.Parse(value, style, new NumberFormatInfo()));
            }

            // Default style
            if (style == NumberStyles.Integer)
            {
                Assert.Equal(expected, UIntPtr.Parse(value, provider));
            }

            // Full overloads
            Assert.True(UIntPtr.TryParse(value, style, provider, out result));
            Assert.Equal(expected, result);
            Assert.Equal(expected, UIntPtr.Parse(value, style, provider));
        }
예제 #2
0
 public static UIntPtr Parse(ReadOnlySpan <char> s, NumberStyles style = NumberStyles.Integer, IFormatProvider?provider = null)
 => UIntPtr.Parse(s, style, provider);
예제 #3
0
 public static UIntPtr Parse(string s, IFormatProvider?provider)
 => UIntPtr.Parse(s, provider);
예제 #4
0
 public static UIntPtr Parse(string s, NumberStyles style, IFormatProvider?provider)
 => UIntPtr.Parse(s, style, provider);
예제 #5
0
 public static UIntPtr Parse(string s, NumberStyles style)
 => UIntPtr.Parse(s, style);
예제 #6
0
 public static UIntPtr Parse(string s)
 => UIntPtr.Parse(s);