TimeZoneInfo::HasSameRules Method (TimeZoneInfo^)

 

Indicates whether the current object and another TimeZoneInfo object have the same adjustment rules.

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

public:
bool HasSameRules(
	TimeZoneInfo^ other
)

Parameters

other
Type: System::TimeZoneInfo^

A second object to compare with the current TimeZoneInfo object.

Return Value

Type: System::Boolean

true if the two time zones have identical adjustment rules and an identical base offset; otherwise, false.

Exception Condition
ArgumentNullException

The other parameter is null.

Like the TimeZoneInfo::Equals(TimeZoneInfo^) method, the HasSameRules method indicates whether two time zones have the same base offset (as defined by the BaseUtcOffset property) and the same adjustment rules. Unlike the TimeZoneInfo::Equals(TimeZoneInfo^) method, HasSameRules does not compare time zone identifiers (as defined by the Id property).

Typically, a number of time zones defined in the registry have the same offset from Coordinated Universal Time (UTC) and the same adjustment rules. The following example displays a list of these time zones to the console.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top
Show: