Converts the current TimeZoneInfo object to a serialized string.
Assembly: mscorlib (in mscorlib.dll)
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 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:
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.
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.