Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

TimeZoneInfo::ToSerializedString Method ()

 

Converts the current TimeZoneInfo object to a serialized string.

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

public:
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
Available since 3.5
Return to top
Show:
© 2017 Microsoft