Returns a sorted collection of all the time zones about which information is available on the local system.
Assembly: mscorlib (in mscorlib.dll)
The method retrieves all available time zone information from the subkeys of the registry's HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zones key. If it is unable to successfully retrieve and parse values for particular string properties of individual TimeZoneInfo objects, this method sets their value to an empty string ("").
The method returns a collection of TimeZoneInfo objects only for time zones defined in the registry. It does not include time zones created using the overloads of the CreateCustomTimeZone method. These are accessible only through the object reference returned by the time zone creation method.
The collection returned by this method is sorted by display name using the current culture. For information about the display name, see DisplayName.
The ReadOnlyCollection<T> object returned by this method supports the IEnumerable<T> interface, which means that it can be iterated using the foreach (in C#) or For Each…Next (in Visual Basic) statements. Each iteration of the loop provides the next TimeZoneInfo object in the collection.
The collection of TimeZoneInfo objects represents time zones defined on the local computer; it does not necessarily provide complete information for all time zones during all time periods. If your application requires time zones not found on the local computer, you can create custom time zones using the overloads of the CreateCustomTimeZone method. For more information, see How to: Create Time Zones Without Adjustment Rules and How to: Create Time Zones with Adjustment Rules.
You can also determine whether an individual time zone is defined on the local computer by calling the FindSystemTimeZoneById method and providing the identifier of the time zone you want to retrieve as a parameter.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.