Remove return statement and throwing directly for obselete methods. (#10477)
authorAhson Ahmed Khan <ahsonkhan@users.noreply.github.com>
Sat, 25 Mar 2017 05:50:14 +0000 (22:50 -0700)
committerGitHub <noreply@github.com>
Sat, 25 Mar 2017 05:50:14 +0000 (22:50 -0700)
src/mscorlib/src/System/ReadOnlySpan.cs
src/mscorlib/src/System/Span.cs
src/mscorlib/src/System/ThrowHelper.cs

index 72754d7..10054c5 100644 (file)
@@ -230,9 +230,7 @@ namespace System
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override bool Equals(object obj)
         {
-            ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan();
-            // Prevent compiler error CS0161: 'Span<T>.Equals(object)': not all code paths return a value
-            return default(bool);
+            throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
         }
 
         /// <summary>
@@ -245,9 +243,7 @@ namespace System
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override int GetHashCode()
         {
-            ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan();
-            // Prevent compiler error CS0161: 'Span<T>.GetHashCode()': not all code paths return a value
-            return default(int);
+            throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
         }
 
         /// <summary>
index e6620f8..bc590d8 100644 (file)
@@ -315,9 +315,7 @@ namespace System
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override bool Equals(object obj)
         {
-            ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan();
-            // Prevent compiler error CS0161: 'Span<T>.Equals(object)': not all code paths return a value
-            return default(bool);
+            throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
         }
 
         /// <summary>
@@ -330,9 +328,7 @@ namespace System
         [EditorBrowsable(EditorBrowsableState.Never)]
         public override int GetHashCode()
         {
-            ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan();
-            // Prevent compiler error CS0161: 'Span<T>.GetHashCode()': not all code paths return a value
-            return default(int);
+            throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
         }
 
         /// <summary>
index b6af3a8..445ea31 100644 (file)
@@ -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,