Char::Equals Method (Object^)


Returns a value that indicates whether this instance is equal to a specified object.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

virtual bool Equals(
	Object^ obj
) override


Type: System::Object^

An object to compare with this instance or null.

Return Value

Type: System::Boolean

true if obj is an instance of Char and equals the value of this instance; otherwise, false.

The comparison performed by this method is based on the encoded values of this instance and obj, not necessarily their lexicographical characteristics.

The following code example demonstrates Equals.

using namespace System;
int main()
   char chA = 'A';
   char chB = 'B';
   Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True"
   Console::WriteLine( 'b'.Equals( chB ) ); // Output: "False"

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top