Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TimeZoneInfo.Equals Method (Object)

.NET Framework 4.6 and 4.5

Determines whether the current TimeZoneInfo object and another object are equal.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Public Overrides Function Equals ( _
	obj As Object _
) As Boolean


Type: System.Object

A second object to compare with the current object.

Return Value

Type: System.Boolean
true if obj is a TimeZoneInfo object that is equal to the current instance; otherwise, false.

This method converts or casts obj to a TimeZoneInfo object and compares it with the current instance. The test for equality is based on a comparison of values. The current TimeZoneInfo instance and obj are considered to be equal under the following conditions:

  • The run-time type of obj is TimeZoneInfo.

  • The two objects have the same Id property value.

  • The two objects have the same adjustment rules.

If obj is Nothing, this method returns false.

The following example uses the Equals(Object) method to determine whether the local time zone is Pacific Time or Eastern Time.

Module Example
   Public Sub Main()
      Dim thisTimeZone As TimeZoneInfo
      Dim obj1, obj2 As Object

      thisTimeZone = TimeZoneInfo.Local
      obj1 = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")
      obj2 = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time")
   End Sub 
End Module 
' The example displays the following output: 
'      True 
'      False

.NET Framework

Supported in: 4.6, 4.5
© 2015 Microsoft