Add Span-based {Try}Parse methods to primitive types (#13389)
authorStephen Toub <stoub@microsoft.com>
Wed, 16 Aug 2017 21:09:29 +0000 (17:09 -0400)
committerGitHub <noreply@github.com>
Wed, 16 Aug 2017 21:09:29 +0000 (17:09 -0400)
commit12d5014ddefd7dab5d2dec23326080c114d1079d
treef2589001103c753505ac4828353c9eb9fedb1b09
parent89d8be12677a5d395d1ec7e62874a4476ea5d4d6
Add Span-based {Try}Parse methods to primitive types (#13389)

* Add Span-based {Try}Parse methods to primitive types

Adds Parse and TryParse methods to Boolean, Byte, Double, Int16, Int32, Int64, SByte, Single, UInt16, UInt32, UInt64, and Decimal.

* Address PR feedback

- Make delegation between overloads as consistent as possible across the primitive types: Boolean, SByte/Byte, Int16/UInt16, and Single/Double were doing it one way, whereas Decimal, Int32/UInt32, and Int64/UInt64 were doing it another way (most of this inconsistency was preexisting this PR, but my previous commit doubled-down on the inconsistency).  Changed the former to be like the latter.
18 files changed:
src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/mscorlib/shared/System/Boolean.cs
src/mscorlib/shared/System/Byte.cs
src/mscorlib/shared/System/Double.cs
src/mscorlib/shared/System/Globalization/NumberFormatInfo.cs
src/mscorlib/shared/System/Int16.cs
src/mscorlib/shared/System/Int32.cs
src/mscorlib/shared/System/Int64.cs
src/mscorlib/shared/System/SByte.cs
src/mscorlib/shared/System/Single.cs
src/mscorlib/shared/System/StringSpanHelpers.cs [new file with mode: 0644]
src/mscorlib/shared/System/UInt16.cs
src/mscorlib/shared/System/UInt32.cs
src/mscorlib/shared/System/UInt64.cs
src/mscorlib/src/System/Decimal.cs
src/mscorlib/src/System/Globalization/TextInfo.cs
src/mscorlib/src/System/Number.cs
src/mscorlib/src/System/ThrowHelper.cs