C# TimeZoneInfo Equals(TimeZoneInfo)
Description
TimeZoneInfo Equals(TimeZoneInfo)
determines whether
the current TimeZoneInfo object and another TimeZoneInfo object are equal.
Syntax
TimeZoneInfo.Equals(TimeZoneInfo)
has the following syntax.
public bool Equals(
TimeZoneInfo other
)
Parameters
TimeZoneInfo.Equals(TimeZoneInfo)
has the following parameters.
other
- A second object to compare with the current object.
Returns
TimeZoneInfo.Equals(TimeZoneInfo)
method returns true if the two TimeZoneInfo objects are equal; otherwise, false.
Example
The following example uses the Equals(TimeZoneInfo) method to determine whether the local time zone is Pacific Time or Eastern Time.
/*from w ww. j av a 2 s . c o m*/
using System;
public class MainClass{
public static void Main(String[] argv){
TimeZoneInfo thisTimeZone, zone1, zone2;
thisTimeZone = TimeZoneInfo.Local;
zone1 = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
zone2 = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
Console.WriteLine(thisTimeZone.Equals(zone1));
Console.WriteLine(thisTimeZone.Equals(zone2));
}
}
The code above generates the following result.