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::FromSerializedString Method (String^)

 

Deserializes a string to re-create an original serialized TimeZoneInfo object.

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

public:
static TimeZoneInfo^ FromSerializedString(
	String^ source
)

Parameters

source
Type: System::String^

The string representation of the serialized TimeZoneInfo object.

Return Value

Type: System::TimeZoneInfo^

The original serialized object.

Exception Condition
ArgumentException

The source parameter is String::Empty.

ArgumentNullException

The source parameter is a null string.

SerializationException

The source parameter cannot be deserialized back into a TimeZoneInfo object.

There is an alternative to providing all the code required to create a time zone that is not found in the registry. You can define a custom time zone and either use the ToSerializedString method in a standalone executable or use an application's setup program to save the time zone as a string. The application can then retrieve this string from its storage location and instantiate it using the FromSerializedString method.

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 the time zone 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