小编Zé *_*yte的帖子

TimeZoneInfo.FindSystemTimeZoneById()在Unity应用程序中抛出异常

如果我在C#控制台应用程序中执行此代码,它可以正常工作.

TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
Console.WriteLine(easternZone.DisplayName);
Run Code Online (Sandbox Code Playgroud)

但是,当我在Unity应用程序中使用相同的方法时,会抛出异常:

System.TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown.
  at System.TimeZoneInfo.FindSystemTimeZoneByFileName (System.String id, System.String filepath) [0x00000] in <filename unknown>:0
  at System.TimeZoneInfo.FindSystemTimeZoneById (System.String id) [0x00000] in <filename unknown>:0
  ...
Run Code Online (Sandbox Code Playgroud)

我注意到的一个奇怪的事情是,当MSDN文档明确表示从注册表中检索信息时,会在名为"FindSystemTimeZoneByFileName"的方法中抛出异常.

c# timezone unity3d-5

4
推荐指数
2
解决办法
5148
查看次数

标签 统计

c# ×1

timezone ×1

unity3d-5 ×1