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



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

Parameters

left
An instance of TdPeriodTime.
right
An instance of TdPeriodTime.

Return Value

A boolean is returned that indicates the result of the comparison.
Remarks

The beginning and ending bounds between the left and right operands are compared to determine whether the two periods are equal. The two periods are equal if the following is true:

    left.Begin == right.Begin && left.End == right.Begin

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

Return Value Description
true

left and right are TdPeriodTime.Null

-or-

left is equal to right.

false

left or right is Null

-or-

left is not equal to right.

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. TdTime implementation is very similar to the Nullable class in this regard.

Example
The following example shows that the Equality operator can safely be used in an if statement.
TdPeriodTime x = TdPeriodTime.Null;
TdPeriodTime y = new TdPeriodTime(new TdTime(10, 10, 10), new TdTime(12, 11, 30));
            
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").
}
            
y = TdPeriodTime.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

TdPeriodTime Structure
TdPeriodTime Members