diff options
author | EgorBo <egorbo@gmail.com> | 2018-06-01 10:23:38 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-06-01 17:54:26 +0300 |
commit | 957ba72461bc1a6b69fb7e120b906b5cd98cfb35 (patch) | |
tree | 48e33a0ec91a6ecf2f1b9b193916646897ab4ee5 | |
parent | 8d8d683b93ddeb1d240afaa832f6f790c6045f83 (diff) |
Add `using System.Diagnostics.Private;` to TimeSpan*.cs
-rw-r--r-- | src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs | 13 | ||||
-rw-r--r-- | src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs b/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs index a66e4600aa..075f1eae3a 100644 --- a/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs +++ b/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs @@ -4,6 +4,7 @@ using System.Text; using System.Diagnostics; +using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Globalization @@ -316,7 +317,17 @@ namespace System.Globalization if (nextChar >= 0 && nextChar != (int)'%') { char nextCharChar = (char)nextChar; - StringBuilder origStringBuilder = FormatCustomized(value, MemoryMarshal.CreateReadOnlySpan<char>(ref nextCharChar, 1), dtfi, result); + ReadOnlySpan<char> nextCharSpan; +#if MONO + // Remove once Mono switches to Fast Spans + unsafe + { + nextCharSpan = new ReadOnlySpan<char>(&nextCharChar, 1); + } +#else + nextCharSpan = MemoryMarshal.CreateReadOnlySpan<char>(ref nextCharChar, 1); +#endif + StringBuilder origStringBuilder = FormatCustomized(value, nextCharSpan, dtfi, result); Debug.Assert(ReferenceEquals(origStringBuilder, result)); tokenLen = 2; } diff --git a/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs b/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs index 51fac39d0a..c6475e02d9 100644 --- a/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs +++ b/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs @@ -49,11 +49,12 @@ //////////////////////////////////////////////////////////////////////////// using System.Diagnostics; +using System.Diagnostics.Private; using System.Text; namespace System.Globalization { - internal static class TimeSpanParse + internal static partial class TimeSpanParse { private const int MaxFractionDigits = 7; private const int MaxDays = 10675199; |