C# StringComparer Equals(String, String)
Description
StringComparer Equals(String, String)
when overridden
in a derived class, indicates whether two strings are equal.
Syntax
StringComparer.Equals(String, String)
has the following syntax.
public abstract bool Equals(
string x,
string y
)
Parameters
StringComparer.Equals(String, String)
has the following parameters.
x
- A string to compare to y.y
- A string to compare to x.
Returns
StringComparer.Equals(String, String)
method returns true if x and y refer to the same object, or x and y are equal; otherwise, false.
Example
using System;/*from w w w . j av a2 s. co m*/
class Sample
{
public static void Main()
{
StringComparer invCmp = StringComparer.Ordinal;
Console.WriteLine(invCmp.Equals("a","a"));
}
}
The code above generates the following result.