Bewerken

Delen via


TimeZoneInfo.TransitionTime.Equals Method

Definition

Determines whether two TimeZoneInfo.TransitionTime objects have identical values.

Overloads

Equals(Object)

Determines whether an object has identical values to the current TimeZoneInfo.TransitionTime object.

Equals(TimeZoneInfo+TransitionTime)

Determines whether the current TimeZoneInfo.TransitionTime object has identical values to a second TimeZoneInfo.TransitionTime object.

Equals(Object)

Source:
TimeZoneInfo.TransitionTime.cs
Source:
TimeZoneInfo.TransitionTime.cs
Source:
TimeZoneInfo.TransitionTime.cs

Determines whether an object has identical values to the current TimeZoneInfo.TransitionTime object.

public:
 override bool Equals(System::Object ^ obj);
public override bool Equals (object? obj);
public override bool Equals (object obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

Parameters

obj
Object

An object to compare with the current TimeZoneInfo.TransitionTime object.

Returns

true if the two objects are equal; otherwise, false.

Examples

The following example illustrates calls to the Equals method.

TimeZoneInfo.TransitionTime tt1 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 02, 00, 00), 11, 03);
TimeZoneInfo.TransitionTime tt2 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 02, 00, 00), 11, 03);
TimeZoneInfo.TransitionTime tt3 = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 02, 00, 00), 10, 05, DayOfWeek.Sunday);
TimeZoneInfo tz = TimeZoneInfo.Local;
Console.WriteLine(tt1.Equals(tz));         // Returns False (overload with argument of type Object)
Console.WriteLine(tt1.Equals(tt1));        // Returns True (an object always equals itself)
Console.WriteLine(tt1.Equals(tt2));        // Returns True (identical property values)
Console.WriteLine(tt1.Equals(tt3));        // Returns False (different property values)
let tt1 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(DateTime(1, 1, 1, 02, 00, 00), 11, 03)
let tt2 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(DateTime(1, 1, 1, 02, 00, 00), 11, 03)
let tt3 = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(DateTime(1, 1, 1, 02, 00, 00), 10, 05, DayOfWeek.Sunday)
let tz = TimeZoneInfo.Local
printfn $"{tt1.Equals tz}"         // Returns False (overload with argument of type Object)
printfn $"{tt1.Equals tt1}"        // Returns True (an object always equals itself)
printfn $"{tt1.Equals tt2}"        // Returns True (identical property values)
printfn $"{tt1.Equals tt3}"        // Returns False (different property values)
Dim tt1 As TimeZoneInfo.TransitionTime = TimeZoneInfo.TransitionTime.CreateFixedDateRule(#02:00:00AM#, 11, 03)
Dim tt2 As TimeZoneInfo.TransitionTime = TimeZoneInfo.TransitionTime.CreateFixedDateRule(#02:00:00AM#, 11, 03)
Dim tt3 As TimeZoneInfo.TransitionTime = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(#02:00:00AM#, 10, 05, DayOfWeek.Sunday)
Dim tz As TimeZoneInfo = TimeZoneInfo.Local
Console.WriteLine(tt1.Equals(tz))          ' Returns False (overload with argument of type Object)
Console.WriteLine(tt1.Equals(tt1))         ' Returns True (an object always equals itself)
Console.WriteLine(tt1.Equals(tt2))         ' Returns True (identical property values)
Console.WriteLine(tt1.Equals(tt3))         ' Returns False (different property values)

Remarks

Equality is defined as follows: The obj parameter must be a TimeZoneInfo.TransitionTime object and must have property values identical to the current TimeZoneInfo.TransitionTime object.

Applies to

Equals(TimeZoneInfo+TransitionTime)

Source:
TimeZoneInfo.TransitionTime.cs
Source:
TimeZoneInfo.TransitionTime.cs
Source:
TimeZoneInfo.TransitionTime.cs

Determines whether the current TimeZoneInfo.TransitionTime object has identical values to a second TimeZoneInfo.TransitionTime object.

public:
 virtual bool Equals(TimeZoneInfo::TransitionTime other);
public bool Equals (TimeZoneInfo.TransitionTime other);
override this.Equals : TimeZoneInfo.TransitionTime -> bool
Public Function Equals (other As TimeZoneInfo.TransitionTime) As Boolean

Parameters

other
TimeZoneInfo.TransitionTime

An object to compare to the current instance.

Returns

true if the two objects have identical property values; otherwise, false.

Implements

Examples

The following example illustrates calls to the Equals method.

TimeZoneInfo.TransitionTime tt1 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 02, 00, 00), 11, 03);
TimeZoneInfo.TransitionTime tt2 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(new DateTime(1, 1, 1, 02, 00, 00), 11, 03);
TimeZoneInfo.TransitionTime tt3 = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(new DateTime(1, 1, 1, 02, 00, 00), 10, 05, DayOfWeek.Sunday);
Console.WriteLine(tt1.Equals(tt1));        // Returns True (an object always equals itself)
Console.WriteLine(tt1.Equals(tt2));        // Returns True (identical property values)
Console.WriteLine(tt1.Equals(tt3));        // Returns False (different property values)
let tt1 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(DateTime(1, 1, 1, 02, 00, 00), 11, 03)
let tt2 = TimeZoneInfo.TransitionTime.CreateFixedDateRule(DateTime(1, 1, 1, 02, 00, 00), 11, 03)
let tt3 = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(DateTime(1, 1, 1, 02, 00, 00), 10, 05, DayOfWeek.Sunday)
printfn $"{tt1.Equals tt1}"        // Returns True (an object always equals itself)
printfn $"{tt1.Equals tt2}"        // Returns True (identical property values)
printfn $"{tt1.Equals tt3}"        // Returns False (different property values)
Dim tt1 As TimeZoneInfo.TransitionTime = TimeZoneInfo.TransitionTime.CreateFixedDateRule(#02:00:00AM#, 11, 03)
Dim tt2 As TimeZoneInfo.TransitionTime = TimeZoneInfo.TransitionTime.CreateFixedDateRule(#02:00:00AM#, 11, 03)
Dim tt3 As TimeZoneInfo.TransitionTime = TimeZoneInfo.TransitionTime.CreateFloatingDateRule(#02:00:00AM#, 10, 05, DayOfWeek.Sunday)
Console.WriteLine(tt1.Equals(tt1))         ' Returns True (an object always equals itself)
Console.WriteLine(tt1.Equals(tt2))         ' Returns True (identical property values)
Console.WriteLine(tt1.Equals(tt3))         ' Returns False (different property values)

Remarks

To determine whether the two TimeZoneInfo.TransitionTime objects are equal, this method performs a property-by-property comparison. The method returns true only if the current TimeZoneInfo.TransitionTime object and the other object have identical values for each of the TimeZoneInfo.TransitionTime object's six property values.

Applies to