Class DateTimeZoneCache
Implements
Inherited Members
Namespace: NodaTime .TimeZones
Assembly: NodaTime.dll
Syntax
public sealed class DateTimeZoneCache : IDateTimeZoneProvider
Remarks
IDateTimeZoneSource
interface to an IDateTimeZoneProvider
.Constructors
DateTimeZoneCache(IDateTimeZoneSource)
Declaration
public DateTimeZoneCache(IDateTimeZoneSource source)
Parameters
Type | Name | Description |
---|---|---|
IDate |
source | The IDate |
Remarks
Exceptions
Type | Condition |
---|---|
Invalid |
source violates its contract. |
Properties
Ids
Declaration
public ReadOnlyCollection<string> Ids { get; }
Property Value
Type | Description |
---|---|
Read |
The IEnumerable<T> of string ids. |
Remarks
This list will be sorted in ordinal lexicographic order. It cannot be modified by callers, and must not be modified by the provider either: client code can safely treat it as thread-safe and deeply immutable.
In addition to the list returned here, providers always support the fixed-offset timezones with IDs "UTC" and "UTC+/-Offset". These may or may not be included explicitly in this list.
this[string]
Declaration
public DateTimeZone this[string id] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | id | The time zone id to find. |
Property Value
Type | Description |
---|---|
Date |
The Date |
Remarks
Unlike Get
Note that this may return a Date
Note also that this method is not required to return the same Date
The fixed-offset timezones with IDs "UTC" and "UTC+/-Offset" are always available.
Exceptions
Type | Condition |
---|---|
Date |
This provider does not support the given ID. |
VersionId
Declaration
public string VersionId { get; }
Property Value
Type | Description |
---|---|
string | The version ID of this provider. |
Methods
GetSystemDefault()
Declaration
public DateTimeZone GetSystemDefault()
Returns
Type | Description |
---|---|
Date |
The provider-specific representation of the system default time zone. |
Remarks
Callers should be aware that this method will throw Date
If it is necessary to handle this case, callers can construct a
BclBclDateTimeZone
may not be available in all versions of Noda Time 1.x and 2.x; see
the class documentation for more details.
Exceptions
Type | Condition |
---|---|
Date |
The system default time zone is not mapped by this provider. |
GetZoneOrNull(string)
Declaration
public DateTimeZone? GetZoneOrNull(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | The time zone ID to find. |
Returns
Type | Description |
---|---|
Date |
The Date |
Remarks
Note that this may return a Date
Note also that this method is not required to return the same Date
The fixed-offset timezones with IDs "UTC" and "UTC+/-Offset" are always available.