共用方式為


TimeZoneInfo.TransitionTime.Equals 方法

定義

判斷兩個 TimeZoneInfo.TransitionTime 物件是否具有完全相同的值。

多載

Equals(Object)

判斷物件的值是否與目前 TimeZoneInfo.TransitionTime 物件的值相等。

Equals(TimeZoneInfo+TransitionTime)

判斷目前 TimeZoneInfo.TransitionTime 物件的值是否與第二個 TimeZoneInfo.TransitionTime 物件的值相等。

Equals(Object)

來源:
TimeZoneInfo.TransitionTime.cs
來源:
TimeZoneInfo.TransitionTime.cs
來源:
TimeZoneInfo.TransitionTime.cs

判斷物件的值是否與目前 TimeZoneInfo.TransitionTime 物件的值相等。

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

參數

obj
Object

要與目前 TimeZoneInfo.TransitionTime 物件比較的物件。

傳回

如果兩個物件相等則為 true,否則為 false

範例

下列範例說明對 方法的 Equals 呼叫。

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)

備註

相等的定義如下:參數 obj 必須是 TimeZoneInfo.TransitionTime 物件,而且必須具有與目前 TimeZoneInfo.TransitionTime 物件相同的屬性值。

適用於

Equals(TimeZoneInfo+TransitionTime)

來源:
TimeZoneInfo.TransitionTime.cs
來源:
TimeZoneInfo.TransitionTime.cs
來源:
TimeZoneInfo.TransitionTime.cs

判斷目前 TimeZoneInfo.TransitionTime 物件的值是否與第二個 TimeZoneInfo.TransitionTime 物件的值相等。

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

參數

other
TimeZoneInfo.TransitionTime

要與目前執行個體比較的物件。

傳回

如果兩個物件的屬性值相同,則為 true;否則為 false

實作

範例

下列範例說明對 方法的 Equals 呼叫。

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)

備註

若要判斷兩 TimeZoneInfo.TransitionTime 個物件是否相等,這個方法會逐一執行屬性比較。 只有當目前物件和 other 物件針對每個 TimeZoneInfo.TransitionTime 物件的六個屬性值具有相同的值時,方法才會傳回 trueTimeZoneInfo.TransitionTime

適用於