From 6613ec75c251dfff265e0f8bfc5d453bdf0e48e7 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sun, 4 Mar 2018 15:55:34 -0500 Subject: [PATCH] Delete stale TryFormat and {Try}Parse overloads (#16746) --- src/mscorlib/shared/System/Byte.cs | 4 ---- src/mscorlib/shared/System/DateTime.cs | 23 ----------------------- src/mscorlib/shared/System/DateTimeOffset.cs | 23 ----------------------- 3 files changed, 50 deletions(-) diff --git a/src/mscorlib/shared/System/Byte.cs b/src/mscorlib/shared/System/Byte.cs index 13ceb75..31185f0 100644 --- a/src/mscorlib/shared/System/Byte.cs +++ b/src/mscorlib/shared/System/Byte.cs @@ -192,10 +192,6 @@ namespace System return Number.FormatInt32(m_value, format, provider); } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public bool TryFormat(Span destination, out int charsWritten, string format, IFormatProvider provider) => - TryFormat(destination, out charsWritten, (ReadOnlySpan)format, provider); - public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format = default, IFormatProvider provider = null) { return Number.TryFormatInt32(m_value, format, provider, destination, out charsWritten); diff --git a/src/mscorlib/shared/System/DateTime.cs b/src/mscorlib/shared/System/DateTime.cs index b5deefa..d3116ee 100644 --- a/src/mscorlib/shared/System/DateTime.cs +++ b/src/mscorlib/shared/System/DateTime.cs @@ -1141,13 +1141,6 @@ namespace System return (DateTimeParse.ParseExact(s, format, DateTimeFormatInfo.GetInstance(provider), style)); } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public static DateTime ParseExact(ReadOnlySpan s, string format, IFormatProvider provider, DateTimeStyles style) - { - if (format == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.format); - return ParseExact(s, (ReadOnlySpan)format, provider, style); - } - public static DateTime ParseExact(ReadOnlySpan s, ReadOnlySpan format, IFormatProvider provider, DateTimeStyles style = DateTimeStyles.None) { DateTimeFormatInfo.ValidateStyles(style, nameof(style)); @@ -1300,10 +1293,6 @@ namespace System return DateTimeFormat.Format(this, format, DateTimeFormatInfo.GetInstance(provider)); } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public bool TryFormat(Span destination, out int charsWritten, string format, IFormatProvider provider) => - TryFormat(destination, out charsWritten, (ReadOnlySpan)format, provider); - public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format = default, IFormatProvider provider = null) => DateTimeFormat.TryFormat(this, destination, out charsWritten, format, DateTimeFormatInfo.GetInstance(provider)); @@ -1359,18 +1348,6 @@ namespace System return DateTimeParse.TryParseExact(s, format, DateTimeFormatInfo.GetInstance(provider), style, out result); } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public static bool TryParseExact(ReadOnlySpan s, string format, IFormatProvider provider, DateTimeStyles style, out DateTime result) - { - if (format == null) - { - result = default; - return false; - } - - return TryParseExact(s, (ReadOnlySpan)format, provider, style, out result); - } - public static bool TryParseExact(ReadOnlySpan s, ReadOnlySpan format, IFormatProvider provider, DateTimeStyles style, out DateTime result) { DateTimeFormatInfo.ValidateStyles(style, nameof(style)); diff --git a/src/mscorlib/shared/System/DateTimeOffset.cs b/src/mscorlib/shared/System/DateTimeOffset.cs index bb21963..1498f93 100644 --- a/src/mscorlib/shared/System/DateTimeOffset.cs +++ b/src/mscorlib/shared/System/DateTimeOffset.cs @@ -669,13 +669,6 @@ namespace System return new DateTimeOffset(dateResult.Ticks, offset); } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public static DateTimeOffset ParseExact(ReadOnlySpan input, string format, IFormatProvider formatProvider, DateTimeStyles styles) - { - if (format == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.format); - return ParseExact(input, (ReadOnlySpan)format, formatProvider, styles); - } - public static DateTimeOffset ParseExact(ReadOnlySpan input, ReadOnlySpan format, IFormatProvider formatProvider, DateTimeStyles styles = DateTimeStyles.None) { styles = ValidateStyles(styles, nameof(styles)); @@ -780,10 +773,6 @@ namespace System return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.GetInstance(formatProvider), Offset); } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public bool TryFormat(Span destination, out int charsWritten, string format, IFormatProvider provider) => - TryFormat(destination, out charsWritten, (ReadOnlySpan)format, provider); - public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format = default, IFormatProvider formatProvider = null) => DateTimeFormat.TryFormat(ClockDateTime, destination, out charsWritten, format, DateTimeFormatInfo.GetInstance(formatProvider), Offset); @@ -862,18 +851,6 @@ namespace System return parsed; } - // TODO https://github.com/dotnet/corefx/issues/25337: Remove this overload once corefx is updated to target the new signatures - public static bool TryParseExact(ReadOnlySpan input, string format, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result) - { - if (format == null) - { - result = default; - return false; - } - - return TryParseExact(input, (ReadOnlySpan)format, formatProvider, styles, out result); - } - public static bool TryParseExact( ReadOnlySpan input, ReadOnlySpan format, IFormatProvider formatProvider, DateTimeStyles styles, out DateTimeOffset result) { -- 2.7.4