System.Decimal.Equals Method

Returns a value indicating whether this instance and a specified decimal object represent the same value.

Syntax

public bool Equals (decimal value)

Parameters

value
An object to compare to this instance.

Returns

true if value is equal to this instance; otherwise, false.

Remarks

This method implements the IEquatable`1 interface, and performs slightly better than decimal.Equals(object) because it does not have to convert the value parameter to an object.

If value has fewer bits (is narrower) than the instance type, some programming languages perform an implicit widening conversion that transforms the value of the parameter into a value with more bits.

For example, suppose the instance type is int and the parameter type is byte. The Microsoft C# compiler generates instructions to represent the value of the parameter as an int object, then generates a int.CompareTo(int) method to compare the int instance and parameter representation.

Consult your programming language's documentation to determine whether its compiler performs implicit widening conversions on numeric types.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0