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



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

Parameters

left
An instance of TdNumber.
right
An instance of TdNumber.

Return Value

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

Return Value Description
true

left and right are TdNumber.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. TdNumber 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.
TdNumber x = TdNumber.Null;
TdNumber y = new TdNumber(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").
}
            
TdNumber y = TdNumber.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
ProductVersionsPlatforms
.NET2.1, 3.1, 6Windows, Linux, MacOS
.NET Framework4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8Windows
.NET Standard2.0Windows, Linux, MacOS
See Also

Reference

TdNumber Structure
TdNumber Members