C# Int32 Equals(Int32)

Description

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

Syntax

Int32.Equals(Int32) has the following syntax.


public bool Equals(
  int obj
)

Parameters

Int32.Equals(Int32) has the following parameters.

  • obj - An Int32 value to compare to this instance.

Returns

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

Example

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


using System;//  w  w w.  j  a  v  a2s.c  o m

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

      Console.WriteLine(mainValue.Equals(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