C# Char Equals(Object)
Description
Char Equals(Object)
returns a value that indicates whether
this instance is equal to a specified object.
Syntax
Char.Equals(Object)
has the following syntax.
public override bool Equals(
Object obj
)
Parameters
Char.Equals(Object)
has the following parameters.
obj
- An object to compare with this instance or null.
Returns
Char.Equals(Object)
method returns true if obj is an instance of Char and equals the value of this instance; otherwise,
false.
Example
The following code example demonstrates Equals.
//from w ww . ja v a2 s . co m
using System;
public class MainClass {
public static void Main() {
char chA = 'A';
char chB = 'B';
Console.WriteLine(chA.Equals('A')); // Output: "True"
Console.WriteLine('b'.Equals(chB)); // Output: "False"
}
}
The code above generates the following result.