Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class NodaTime.​TimeZones.​ZoneEqualityComparer

Assembly: NodaTime

Inheritance: object → ZoneEqualityComparer

Implemented Interfaces

Equality comparer for time zones, comparing specific aspects of the zone intervals within a time zone for a specific interval of the time line.

Remarks

The default behaviour of this comparator is to consider two time zones to be equal if they share the same wall offsets at all points within a given time interval, regardless of other aspects of each <see cref="T:NodaTime.TimeZones.ZoneInterval" /> within the two time zones. This behaviour can be changed using the <see cref="M:NodaTime.TimeZones.ZoneEqualityComparer.WithOptions(NodaTime.TimeZones.ZoneEqualityComparer.Options)" /> method.

Methods

public static ZoneEqualityComparer
ForInterval​(Interval interval)
Returns a <see cref="T:NodaTime.TimeZones.ZoneEqualityComparer" /> for the given interval with the default options.
Returns A ZoneEqualityComparer for the given interval with the default options.
interval The interval over which to compare time zones. This must have both a start and an end.
Remarks The default behaviour of this comparator is to consider two time zones to be equal if they share the same wall offsets at all points within a given interval. To specify non-default options, call the <see cref="M:NodaTime.TimeZones.ZoneEqualityComparer.WithOptions(NodaTime.TimeZones.ZoneEqualityComparer.Options)" /> method on the result of this method.
WithOptions​(Options options)
public bool
Equals​(DateTimeZone x, DateTimeZone y)
Compares two time zones for equality according to the options and interval provided to this comparer.
Returns <c>true</c> if the specified time zones are equal under the options and interval of this comparer; otherwise, <c>false</c> .
x The first <see cref="T:NodaTime.DateTimeZone" /> to compare.
y The second <see cref="T:NodaTime.DateTimeZone" /> to compare.
public int
GetHashCode​(DateTimeZone obj)
Returns a hash code for the specified time zone.
Returns A hash code for the specified object.
obj The time zone to compute a hash code for.
Remarks The hash code generated by any instance of <c>ZoneEqualityComparer</c> will be equal to the hash code generated by any other instance constructed with the same options and interval, for the same time zone (or equal ones). Two instances of <c>ZoneEqualityComparer</c> with different options or intervals may (but may not) produce different hash codes for the same zone.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object