Remove dead case from string.Compare (dotnet/coreclr#18345)
authorStephen Toub <stoub@microsoft.com>
Thu, 7 Jun 2018 17:24:11 +0000 (13:24 -0400)
committerJan Kotas <jkotas@microsoft.com>
Thu, 7 Jun 2018 17:24:11 +0000 (10:24 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/33910ce097e4812d17edad61c88c9c348ed80fa8

src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs

index 99efcbe..3ddc90a 100644 (file)
@@ -415,11 +415,9 @@ namespace System
                 case StringComparison.Ordinal:
                     return CompareOrdinalHelper(strA, indexA, lengthA, strB, indexB, lengthB);
 
-                case StringComparison.OrdinalIgnoreCase:
-                    return CompareInfo.CompareOrdinalIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB);
-
                 default:
-                    throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
+                    Debug.Assert(comparisonType == StringComparison.OrdinalIgnoreCase); // CheckStringComparison validated these earlier
+                    return CompareInfo.CompareOrdinalIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB);
             }
         }