Send feedback on this topic.
Teradata.Client.Provider
Equality Operator (TdDecimal)
Example 



Teradata.Client.Provider Namespace > TdDecimal Structure : Equality Operator
An instance of TdDecimal.
An instance of TdDecimal.
Compares two TdDecimals to determine whether the left operand is equal to the right operand.
Syntax
'Declaration
 
Public Operator =( _
   ByVal left As TdDecimal, _
   ByVal right As TdDecimal _
) As Boolean
'Usage
 
public bool operator ==( 
   TdDecimal left,
   TdDecimal right
)
public:
bool operator ==( 
   TdDecimal left,
   TdDecimal right
)

Parameters

left
An instance of TdDecimal.
right
An instance of TdDecimal.

Return Value

true if the left is equal to the right, false otherwise.

Return Value Description
true

left and right are TdDecimal.Null

-or-

left is equal to right.

false

left or right is Null

-or-

left is not equal to right.

Remarks
Unlike comparison operators, Equality operators do not always return false when left and right operands are Null. Therefore the reverse condition can be considered true. TdDecimal implementation is very similar to the Nullable class in this regard.
Example
Following example shows that the Equality operator can safely be used in an if statement.
TdDecimal x = TdDecimal.Null;
TdDecimal y = new TdDecimal(1.0M);
            
if (x == y)
{
    // x is equal to y.
    Console.WriteLine(@"X is equal to Y").
}
else
{
    // x is not equal y
    Console.WriteLine(@"X is not equal to Y").
}
            
TdDecimal y = TdDecimal.Null;
            
if (x == y)
{
    // x is equal to y.
    Console.WriteLine(@"X is equal to Y").
}
else
{
    // x is not equal y
    Console.WriteLine(@"X is not equal to Y").
}
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDecimal Structure
TdDecimal Members