如何:获取时区的.NET Framework 2.0时区、NET、Framework

2023-09-06 07:26:52 作者:伴你99不会走

我要寻找能获取可用时区的方法。 使用.NET Framework 3.5我的方法做同样的,但我期待使用.NET Framework 2.0去取。 .NET Framework 3.5的具体code是如下:

I am looking for a method which can fetch available time zones. Using .net framework 3.5 I got method to do the same, but I am looking to fetch it using .net framework 2.0. .net framework 3.5 specific code is as follows;

Dim timeZones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()
For Each timeZoneInfo As TimeZoneInfo In timeZones
    Console.WriteLine("{0}", timeZoneInfo.DisplayName)
Next

在此先感谢任何形式的帮助。

Thanks in advance for any kind of help.

推荐答案

我相信这篇文章包含的兼容源.NET 2.0:

I believe this article contains the source that is compatible with .NET 2.0:

HTTP://www.$c$cproject.com/KB/ VB / TimeZoneInfo.aspx

如果你抓住他们的源代码,你可以看看他们是如何做到 GetTimeZones 方法,其时区类。

If you grab their source you can check out how they did GetTimeZones method for their TimeZone class.