C# Char Equals(Char)

Description

Char Equals(Char) returns a value that indicates whether this instance is equal to the specified Char object.

Syntax

Char.Equals(Char) has the following syntax.


public bool Equals(
  char obj
)

Parameters

Char.Equals(Char) has the following parameters.

  • obj - An object to compare to this instance.

Returns

Char.Equals(Char) method returns true if the obj parameter equals the value of this instance; otherwise, false.

Example

The following code shows how to use Char.Equals(Char) method.


using System;/*from  ww w  . ja v a  2s  .  c o  m*/
public class MainClass {
  public static void Main(String[] argv){  
    char c = 'a';
    char c1 = 'a';
    System.Console.WriteLine(c.Equals(c1));
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version