C# Boolean Equals(Boolean)

Description

Boolean Equals(Boolean) returns a value indicating whether this instance is equal to a specified Boolean object.

Syntax

Boolean.Equals(Boolean) has the following syntax.


public bool Equals(
  bool obj
)

Parameters

Boolean.Equals(Boolean) has the following parameters.

  • obj - A Boolean value to compare to this instance.

Returns

Boolean.Equals(Boolean) method returns true if obj has the same value as this instance; otherwise, false.

Example

The following code example demonstrates Boolean.Equals(Boolean).


using System;/*  ww w. j a v  a 2  s  . c o  m*/

class Sample 
{
    public static void Main() 
    {
        Boolean a1 = true;
        Boolean a2 = true;
        Console.WriteLine(a1.Equals(a2));
    }
}

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