备忘:.NET的CultureInfo

使用C#进行开发时如果碰到需要使用CultureInfo而又没有显示指定时(例如:DateTime的ToString,string.Format等)会发生什么呢?

  • Console程序:程序默认会从Thread.CurrentThread.CurrentCulture获取CultureInfo,而该CultureInfo来自执行程序的登录用户在控制面板中的地区和语言的配置。
  • WindowService
    • 如果该WindowService是以某个OS用户的身份运行的,则程序默认会读取该用户在地区和语言中的配置;
    • 如果该WindowService是以LocalSystem运行的,程序默认会从注册表的"HKEY_USERS/.DEFAULT/Control Panel/International"中获取;

引用自:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/8fbca78b-5078-4a12-8abb-4051076febbb/c-windows-service-culture-info-problem

相关链接:

How does a .NET process get the culture information?

Default Culture in a Windows Service

Add the Log on as a service right to an account

ANSI Code Page for Windows System Locale with Identifier Constants and Strings

The .Default user is not the default user

转载于:https://www.cnblogs.com/royliugc/p/5051407.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值