This documentation is archived and is not being maintained.

TimeZoneInfo::ToSerializedString Method

Converts the current TimeZoneInfo object to a serialized string.

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

String^ ToSerializedString()

Return Value

Type: System::String
A string that represents the current TimeZoneInfo object.

Applications that rely on time zones that are not typically defined in the registry of Windows systems can use the CreateCustomTimeZone method to instantiate the necessary time zones as TimeZoneInfo objects. The application can then call the ToSerializedString method to convert the time zone object to a string.

The TimeZoneInfo object should also be stored in a location where the application can retrieve it when needed. Possible locations include:

  • The registry.

  • An application resource file.

  • An external file, such as a text file.

The following example tries to retrieve the Antarctica/South Pole time zone from the local system. If it fails, the code tries to retrieve information about the time zone from a text file in the application directory. If this attempt fails, the code creates the time zone and writes information about it to the text file.

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

.NET Framework

Supported in: 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.