Condividi tramite


TimeZoneInfo.TransitionTime.Equals Metodo

Definizione

Determina se due oggetti TimeZoneInfo.TransitionTime hanno valori identici.

Overload

Equals(Object)

Determina se un oggetto ha valori identici rispetto all'oggetto TimeZoneInfo.TransitionTime corrente.

Equals(TimeZoneInfo+TransitionTime)

Determina se l'oggetto TimeZoneInfo.TransitionTime corrente ha valori identici rispetto a un secondo oggetto TimeZoneInfo.TransitionTime.

Equals(Object)

Determina se un oggetto ha valori identici rispetto all'oggetto TimeZoneInfo.TransitionTime corrente.

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

Parametri

obj
Object

Oggetto da confrontare con l'oggetto TimeZoneInfo.TransitionTime corrente.

Restituisce

Boolean

true se i due oggetti sono uguali; in caso contrario, false.

Esempio

Nell'esempio seguente vengono illustrate le chiamate al Equals metodo .

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)

Commenti

L'uguaglianza è definita come segue: il obj parametro deve essere un TimeZoneInfo.TransitionTime oggetto e deve avere valori di proprietà identici all'oggetto corrente TimeZoneInfo.TransitionTime .

Si applica a

Equals(TimeZoneInfo+TransitionTime)

Determina se l'oggetto TimeZoneInfo.TransitionTime corrente ha valori identici rispetto a un secondo oggetto 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

Parametri

other
TimeZoneInfo.TransitionTime

Oggetto da confrontare con l'istanza corrente.

Restituisce

Boolean

true se i due oggetti hanno valori delle proprietà identici. In caso contrario, false.

Implementazioni

Esempio

Nell'esempio seguente vengono illustrate le chiamate al Equals metodo .

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)

Commenti

Per determinare se i due TimeZoneInfo.TransitionTime oggetti sono uguali, questo metodo esegue un confronto di proprietà per proprietà. Il metodo restituisce true solo se l'oggetto corrente TimeZoneInfo.TransitionTime e l'oggetto other hanno valori identici per ognuno dei sei valori di TimeZoneInfo.TransitionTime proprietà dell'oggetto.

Si applica a