Change string.Compare(...) == 0 occurrences to string.Equals(...) (dotnet/coreclr...
authorStephen Toub <stoub@microsoft.com>
Sat, 23 Jun 2018 14:20:29 +0000 (10:20 -0400)
committerJan Kotas <jkotas@microsoft.com>
Sat, 23 Jun 2018 14:20:29 +0000 (07:20 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/e1a6bdb037e1a79ad7009fb81eecfd6bd1bbfe65

src/coreclr/src/System.Private.CoreLib/src/System/Diagnostics/Stacktrace.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Resources/ResourceManager.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/StringComparer.cs

index 3e4da5c..e6351a3 100644 (file)
@@ -181,7 +181,7 @@ namespace System.Diagnostics
                     string ns = t.Namespace;
                     if (ns == null)
                         break;
-                    if (string.Compare(ns, PackageName, StringComparison.Ordinal) != 0)
+                    if (!string.Equals(ns, PackageName, StringComparison.Ordinal))
                         break;
                 }
                 iRetVal++;
index 62c6f26..bb61fe0 100644 (file)
@@ -219,7 +219,7 @@ namespace System.Reflection.Emit
             {
                 foreach (string name in m_TypeBuilderDict.Keys)
                 {
-                    if (string.Compare(name, strTypeName, (StringComparison.OrdinalIgnoreCase)) == 0)
+                    if (string.Equals(name, strTypeName, StringComparison.OrdinalIgnoreCase))
                         return m_TypeBuilderDict[name];
                 }
             }
index c7548b6..6294f09 100644 (file)
@@ -680,11 +680,11 @@ namespace System.Resources
 
             // case insensitive
             AssemblyName an1 = new AssemblyName(asmTypeName1.Substring(comma));
-            if (string.Compare(an1.Name, asmName2.Name, StringComparison.OrdinalIgnoreCase) != 0)
+            if (!string.Equals(an1.Name, asmName2.Name, StringComparison.OrdinalIgnoreCase))
                 return false;
 
             // to match IsMscorlib() in VM
-            if (string.Compare(an1.Name, System.CoreLib.Name, StringComparison.OrdinalIgnoreCase) == 0)
+            if (string.Equals(an1.Name, System.CoreLib.Name, StringComparison.OrdinalIgnoreCase))
                 return true;
 
 
index 59fb59e..72f2bde 100644 (file)
@@ -3254,7 +3254,7 @@ namespace System.Diagnostics.Tracing
         {
             // If the first parameter is (case insensitive) 'relatedActivityId' then skip it.  
             if (args.Length > 0 && args[0].ParameterType == typeof(Guid) &&
-                string.Compare(args[0].Name, "relatedActivityId", StringComparison.OrdinalIgnoreCase) == 0)
+                string.Equals(args[0].Name, "relatedActivityId", StringComparison.OrdinalIgnoreCase))
             {
                 var newargs = new ParameterInfo[args.Length - 1];
                 Array.Copy(args, 1, newargs, 0, args.Length - 1);
index cb2d32f..9a209a4 100644 (file)
@@ -293,7 +293,7 @@ namespace System
                 {
                     return false;
                 }
-                return (string.Compare(x, y, StringComparison.OrdinalIgnoreCase) == 0);
+                return string.Equals(x, y, StringComparison.OrdinalIgnoreCase);
             }
             return x.Equals(y);
         }