C# Decimal Equals(Object)

Description

Decimal Equals(Object) returns a value indicating whether this instance and a specified Object represent the same type and value.

Syntax

Decimal.Equals(Object) has the following syntax.


public override bool Equals(
  Object value
)

Parameters

Decimal.Equals(Object) has the following parameters.

  • value - The object to compare with this instance.

Returns

Decimal.Equals(Object) method returns true if value is a Decimal and equal to this instance; otherwise, false.

Example

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


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

class DecimalMulDivRemDemo
{

    public static void Main( )
    {
        decimal d = 1000M;
        Console.WriteLine(d.Equals((Object)7M) );
    }
}

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