From 082fd6e07823b7418820708641b1640376e7bfc6 Mon Sep 17 00:00:00 2001 From: Ahson Ahmed Khan Date: Fri, 24 Mar 2017 22:50:14 -0700 Subject: [PATCH] Remove return statement and throwing directly for obselete methods. (#10477) --- src/mscorlib/src/System/ReadOnlySpan.cs | 8 ++------ src/mscorlib/src/System/Span.cs | 8 ++------ src/mscorlib/src/System/ThrowHelper.cs | 10 ---------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/mscorlib/src/System/ReadOnlySpan.cs b/src/mscorlib/src/System/ReadOnlySpan.cs index 72754d7..10054c5 100644 --- a/src/mscorlib/src/System/ReadOnlySpan.cs +++ b/src/mscorlib/src/System/ReadOnlySpan.cs @@ -230,9 +230,7 @@ namespace System [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) { - ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan(); - // Prevent compiler error CS0161: 'Span.Equals(object)': not all code paths return a value - return default(bool); + throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan); } /// @@ -245,9 +243,7 @@ namespace System [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() { - ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan(); - // Prevent compiler error CS0161: 'Span.GetHashCode()': not all code paths return a value - return default(int); + throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan); } /// diff --git a/src/mscorlib/src/System/Span.cs b/src/mscorlib/src/System/Span.cs index e6620f8..bc590d8 100644 --- a/src/mscorlib/src/System/Span.cs +++ b/src/mscorlib/src/System/Span.cs @@ -315,9 +315,7 @@ namespace System [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) { - ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan(); - // Prevent compiler error CS0161: 'Span.Equals(object)': not all code paths return a value - return default(bool); + throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan); } /// @@ -330,9 +328,7 @@ namespace System [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() { - ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan(); - // Prevent compiler error CS0161: 'Span.GetHashCode()': not all code paths return a value - return default(int); + throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan); } /// diff --git a/src/mscorlib/src/System/ThrowHelper.cs b/src/mscorlib/src/System/ThrowHelper.cs index b6af3a8..445ea31 100644 --- a/src/mscorlib/src/System/ThrowHelper.cs +++ b/src/mscorlib/src/System/ThrowHelper.cs @@ -70,16 +70,6 @@ namespace System throw new ArgumentException(SR.Argument_DestinationTooShort); } - internal static void ThrowNotSupportedException_CannotCallEqualsOnSpan() - { - throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan); - } - - internal static void ThrowNotSupportedException_CannotCallGetHashCodeOnSpan() - { - throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan); - } - internal static void ThrowArgumentOutOfRange_IndexException() { throw GetArgumentOutOfRangeException(ExceptionArgument.index, -- 2.7.4