C# Decimal Equals(Decimal)

Description

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

Syntax

Decimal.Equals(Decimal) has the following syntax.


public bool Equals(
  decimal value
)

Parameters

Decimal.Equals(Decimal) has the following parameters.

  • value - An object to compare to this instance.

Returns

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

Example

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


using System;/*from   w w w .j  a  v  a  2  s . c om*/

class DecimalMulDivRemDemo
{

    public static void Main( )
    {
        decimal d = 1000M;
        Console.WriteLine(d.Equals(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