Compartir a través de


TimeZoneInfo.Equals Method (TimeZoneInfo)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Function Equals ( _
    other As TimeZoneInfo _
) As Boolean
public bool Equals(
    TimeZoneInfo other
)

Parameters

Return Value

Type: System.Boolean
true if the two TimeZoneInfo objects are equal; otherwise, false.

Implements

IEquatable<T>.Equals(T)

Remarks

Equality is based on a comparison of values.

If the other parameter is an uninitialized TimeZoneInfo object, this method returns false.

Version Notes

XNA Framework

 When this method is used in the XNA Framework, it throws a NotSupportedException exception.

Examples

The following example uses the Equals(TimeZoneInfo) method to determine whether a TimeZoneInfo variable is identical to the local time zone returned by the Local property.

Dim thisTimeZone As TimeZoneInfo

thisTimeZone = TimeZoneInfo.Local
outputBlock.Text &= thisTimeZone.Equals(TimeZoneInfo.Local) & vbCrLf
outputBlock.Text &= thisTimeZone.Equals(TimeZoneInfo.Utc) & vbCrLf
TimeZoneInfo thisTimeZone;

thisTimeZone = TimeZoneInfo.Local;
outputBlock.Text += thisTimeZone.Equals(TimeZoneInfo.Local) + "\n";
outputBlock.Text += thisTimeZone.Equals(TimeZoneInfo.Utc) + "\n";

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.