C# Decimal Inequality
Description
Decimal Inequality
returns a value that indicates whether
two Decimal objects have different values.
Syntax
Decimal.Inequality
has the following syntax.
public static bool operator !=(
decimal d1,
decimal d2
)
Parameters
Decimal.Inequality
has the following parameters.
d1
- The first value to compare.d2
- The second value to compare.
Returns
Decimal.Inequality
method returns true if d1 and d2 are not equal; otherwise, false.
Example
The Inequality method defines the operation of the inequality operator for Decimal values. It enables code such as the following:
using System;//from w w w . jav a 2 s. c o m
public class Example
{
public static void Main()
{
Decimal number1 = 1.0695m;
Decimal number2 = 1.0699m;
Console.WriteLine("{0} <> {1}: {2}", number1,
number2, number1 != number2);
}
}
The code above generates the following result.