StringComparer.Equals Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
When overridden in a derived class, indicates whether two objects or strings are equal.
Overloads
Equals(Object, Object) |
When overridden in a derived class, indicates whether two objects are equal. |
Equals(String, String) |
When overridden in a derived class, indicates whether two strings are equal. |
Equals(Object, Object)
- Source:
- StringComparer.cs
- Source:
- StringComparer.cs
- Source:
- StringComparer.cs
When overridden in a derived class, indicates whether two objects are equal.
public:
virtual bool Equals(System::Object ^ x, System::Object ^ y);
public:
bool Equals(System::Object ^ x, System::Object ^ y);
public bool Equals (object? x, object? y);
public bool Equals (object x, object y);
override this.Equals : obj * obj -> bool
Public Function Equals (x As Object, y As Object) As Boolean
Parameters
- x
- Object
An object to compare to y
.
- y
- Object
An object to compare to x
.
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, or both x
and y
are null
; otherwise, false
.
Implements
Remarks
Because the runtime does not have to unbox x
or y
if they are value types or attempt to downcast x
or y
to strings if they are reference types, the Equals(String, String) method may be slightly more efficient than the Equals(Object, Object) method.
Applies to
Equals(String, String)
- Source:
- StringComparer.cs
- Source:
- StringComparer.cs
- Source:
- StringComparer.cs
When overridden in a derived class, indicates whether two strings are equal.
public:
abstract bool Equals(System::String ^ x, System::String ^ y);
public abstract bool Equals (string x, string y);
public abstract bool Equals (string? x, string? y);
override this.Equals : string * string -> bool
Public MustOverride Function Equals (x As String, y As String) As Boolean
Parameters
- x
- String
A string to compare to y
.
- y
- String
A string to compare to x
.
Returns
true
if x
and y
refer to the same object, or x
and y
are equal, or x
and y
are null
; otherwise, false
.
Implements
Remarks
Because the runtime does not have to unbox x
or y
if they are value types or attempt to downcast x
or y
to strings if they are reference types, the Equals(String, String) method may be slightly more efficient than the Equals(Object, Object) method.