Export (0) Print
Expand All

TimeZoneInfo.ClearCachedData Method

Clears cached time zone data.

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

static member ClearCachedData : unit -> unit

Cached time zone data includes data on the local time zone, the Coordinated Universal Time (UTC) zone, and any time zones that are retrieved by using methods such as FindSystemTimeZoneById and GetSystemTimeZones.

You might call the ClearCachedData method to reduce the memory devoted to the application's cache of time zone information or to reflect the fact that the local system's time zone has changed.

Storing references to the local and UTC time zones is not recommended. After the call to the ClearCachedData method, these object variables will be undefined TimeZoneInfo objects that are no longer references to TimeZoneInfo.Local or TimeZoneInfo.Utc. For example, in the following code, the second call to the TimeZoneInfo.ConvertTime(DateTime, TimeZoneInfo, TimeZoneInfo) method throws an ArgumentException because the local variable is no longer considered equal to TimeZoneInfo.Local.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft