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



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

Parameters

left
An instance of TdPeriodTimestamp.
right
An instance of TdPeriodTimestamp.

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 TdPeriodTimestamp.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. TdDate 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.
TdPeriodTimestamp x = TdPeriodTimestamp.Null;
TdPeriodTimestamp y = new TdPeriodTimestamp(
                        new TdTimestamp(2008, 10, 10, 12, 10, 33), 
                        new TdTimestamp(2008, 11, 30, 14, 11, 22));
            
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 = TdPeriodTimestamp.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

TdPeriodTimestamp Structure
TdPeriodTimestamp Members