TimeZoneInfo.Equals Method (TimeZoneInfo)
Assembly: mscorlib (in mscorlib.dll)
Equality is based on a comparison of values. Two TimeZoneInfo objects are considered to be equal under the following conditions:
The value of their Id property is the same.
They have the same adjustment rules.
returns the Boolean value that results from evaluating the following expression:
other.Id == this.Id && HasSameRules(other);
other.Id = me.Id AndAlso HasSameRules(other)
If the other parameter is an uninitialized TimeZoneInfo object, this method returns false.
The following example uses themethod to determine whether the local time zone is Pacific Time or Eastern Time.
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));
Available since 8
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1