== Why is this an issue?

Many string operations, the ``++Compare++`` and ``++Equals++`` methods in particular, provide an overload that accepts a ``++StringComparison++`` enumeration value as a parameter. Calling these overloads and explicitly providing this parameter makes your code clearer and easier to maintain.


This rule raises an issue when a string comparison operation doesn't use the overload that takes a ``++StringComparison++`` parameter.


=== Noncompliant code example

[source,csharp]
----
using System;

namespace MyLibrary
{
  public class Foo
  {
    public bool HaveSameNames(string name1, string name2)
    {
      return string.Compare(name1, name2) == 0; // Noncompliant
    }
  }
}
----


=== Compliant solution

[source,csharp]
----
using System;

namespace MyLibrary
{
  public class Foo
  {
    public bool HaveSameNames(string name1, string name2)
    {
      return string.Compare(name1, name2, StringComparison.OrdinalIgnoreCase) == 0;
    }
  }
}
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Change this string comparison to an overload that accept a "StringComparison" as a parameter.


=== Highlighting

The string comparison method call


endif::env-github,rspecator-view[]
