C# StringComparer Equals(Object, Object)
Description
StringComparer Equals(Object, Object)
when overridden
in a derived class, indicates whether two objects are equal.
Syntax
StringComparer.Equals(Object, Object)
has the following syntax.
public bool Equals(
Object x,
Object y
)
Parameters
StringComparer.Equals(Object, Object)
has the following parameters.
x
- An object to compare to y.y
- An object to compare to x.
Returns
StringComparer.Equals(Object, Object)
method returns true if x and y refer to the same object, or x and y are both the same type of object
and those objects are equal; otherwise, false.
Example
using System;//from w w w . ja v a 2 s .c om
class Sample
{
public static void Main()
{
StringComparer invCmp = StringComparer.Ordinal;
Console.WriteLine(invCmp.Compare(StringComparer.Ordinal,StringComparer.InvariantCulture));
}
}
The code above generates the following result.