Class BclDateTimeZone
Representation of a time zone converted from a System.TimeZoneInfo from the Base Class Library.
Since 1.0.x
Availability net35-Client
Implements
IEquatable<DateTimeZone>
Inherited Members
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.TimeZones
Assembly: NodaTime.dll
Syntax
public sealed class BclDateTimeZone : DateTimeZone, IEquatable<DateTimeZone>, IZoneIntervalMap
Remarks
Note that although this class implements System.IEquatable<T> by virtue of extending
DateTimeZone, the implementation here will always throw
NotImplementedException
when asked
to compare two different BclDateTimeZone
instances.
Properties
DisplayName
Returns the display name associated with the time zone, as provided by the Base Class Library.
Since 1.0.x
Availability net35-Client
Declaration
public string DisplayName { get; }
Property Value
Type | Description |
---|---|
String |
OriginalZone
Returns the original System.TimeZoneInfo from which this was created.
Since 1.0.x
Availability net35-Client
Declaration
public TimeZoneInfo OriginalZone { get; }
Property Value
Type | Description |
---|---|
TimeZoneInfo |
Methods
EqualsImpl(DateTimeZone)
Implements equality in derived classes.
Since 1.0.x
Availability net35-Client
Declaration
protected override bool EqualsImpl(DateTimeZone zone)
Parameters
Type | Name | Description |
---|---|---|
DateTimeZone | zone | The zone to compare with this one. This is guaranteed (when called by Equals(DateTimeZone)) to be a non-null reference of the same type as this instance. |
Returns
Type | Description |
---|---|
Boolean |
true if the specified DateTimeZone is equal to this instance;
otherwise, false .
|
Overrides
Remarks
This implementation always throws
NotImplementedException
.
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Always. |
ForSystemDefault()
Returns a time zone converted from the BCL representation of the system local time zone.
Since 1.0.x
Availability net35-Client
Declaration
public static BclDateTimeZone ForSystemDefault()
Returns
Type | Description |
---|---|
BclDateTimeZone | A BclDateTimeZone wrapping the "local" (system) time zone as returned by System.TimeZoneInfo.Local. |
Remarks
This method is approximately equivalent to calling GetSystemDefault() with an implementation that wraps BclDateTimeZoneSource (e.g. Bcl), with the exception that it will succeed even if the current local time zone was not one of the set of system time zones captured when the source was created (which, while highly unlikely, might occur either because the local time zone is not a system time zone, or because the system time zones have themselves changed).
This method will retain a reference to the returned BclDateTimeZone
, and will attempt to return it if
called repeatedly (assuming that the local time zone has not changed) rather than creating a new instance,
though this behaviour is not guaranteed.
FromTimeZoneInfo(TimeZoneInfo)
Creates a new BclDateTimeZone from a System.TimeZoneInfo from the Base Class Library.
Since 1.0.x
Availability net35-Client
Declaration
public static BclDateTimeZone FromTimeZoneInfo(TimeZoneInfo bclZone)
Parameters
Type | Name | Description |
---|---|---|
TimeZoneInfo | bclZone | The original time zone to take information from. |
Returns
Type | Description |
---|---|
BclDateTimeZone | A BclDateTimeZone wrapping the given TimeZoneInfo . |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | bclZone is null. |
GetHashCode()
Returns a hash code for this instance.
Since 1.0.x
Availability net35-Client
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
GetZoneInterval(Instant)
Gets the zone interval for the given instant; the range of time around the instant in which the same Offset
applies (with the same split between standard time and daylight saving time, and with the same offset).
Since 1.0.x
Availability net35-Client
Declaration
public override ZoneInterval GetZoneInterval(Instant instant)
Parameters
Type | Name | Description |
---|---|---|
Instant | instant | The Instant to query. |
Returns
Type | Description |
---|---|
ZoneInterval | The defined ZoneInterval. |
Overrides
Remarks
This will always return a valid zone interval, as time zones cover the whole of time.
See Also
Implements
System.IEquatable<T>