Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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)

public override bool Equals(
	object obj
)

Parameters

obj
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 System;

public class EqualsSample {
	public static void 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
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2016 Microsoft