C# Int32 Equals(Object)

Description

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

Syntax

Int32.Equals(Object) has the following syntax.


public override bool Equals(
  Object obj
)

Parameters

Int32.Equals(Object) has the following parameters.

  • obj - An object to compare with this instance.

Returns

Int32.Equals(Object) method returns true if obj is an instance of Int32 and equals the value of this instance; otherwise, false.

Example

The following example demonstrates the Int32.Equals(Object) method.


using System;//from w  w  w.  j ava 2s.  c o  m

public class ValueComparison
{
   public static void Main()
   {
      int mainValue = 16325;
      int zeroValue = 0;

      Console.WriteLine(mainValue.Equals((Object)zeroValue));

   }
}

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