C# Boolean Equals(Object)

Description

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

Syntax

Boolean.Equals(Object) has the following syntax.


public override bool Equals(
  Object obj
)

Parameters

Boolean.Equals(Object) has the following parameters.

  • obj - An object to compare to this instance.

Returns

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

Example

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


using System;/*from   ww w  .ja  v a 2s.  co  m*/

class Sample 
{
    public static void Main() 
    {
        Boolean a1 = true;
        Object 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