【问题标题】:Accessing A CultureInfo setting (locale)?访问 CultureInfo 设置(区域设置)?
【发布时间】:2011-07-01 21:05:24
【问题描述】:

如果我在 Global.asax 中设置用户的文化信息,使得 strCulture 是区域设置“en-US”:

System.Threading.Thread.CurrentThread.CurrentCulture
    = new System.Globalization.CultureInfo(strCulture);

System.Threading.Thread.CurrentThread.CurrentUICulture
    = new System.Globalization.CultureInfo(strCulture);

那么我如何访问我在应用程序其他地方设置的文化(登录后)?

谢谢。

【问题讨论】:

  • 不清楚您何时设置它,也不清楚您所说的“其他地方”是什么意思。我认为这不是System.Threading.Thread.CurrentThread.CurrentCulture 的明显答案是有原因的?

标签: c# asp.net cultureinfo


【解决方案1】:

在发布此内容之前我也考虑了很多,但正如 Peter 前面在评论中提到的那样,我真的想不出比使用 CurrentUICulture 更好的方法。

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

如果这不是您想要的,请向我们提供更多信息。 :)

【讨论】:

    猜你喜欢
    • 2011-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-17
    相关资源
    最近更新 更多