简体   繁体   English

当我的应用程序不会迁移时,我应该关心文化吗?

[英]Should I care about culture, when my app will not emigrate?

ReSharper wants to change this: ReSharper希望更改此设置:

platypusID = DuckbillValues[i - 1].ToString();

..to this: ..为此:

platypusID = DuckbillValues[i - 1].ToString(CultureInfo.InvariantCulture);

Since the chances are great that my app will only be used in the US, which of the following would I be to acquiesce: 由于我的应用仅在美国使用的机会很大,因此我会默认以下哪一项:

1) Smart
2) Dumb
3) Neither smart nor dumb
4) Smart, but not for that reason
5) Dumb, but not for that reason

Since the chances are great that my app will only be used in the US 由于我的应用仅在美国使用的机会很大

Even if you're app is only used in the US, there's always a chance, if you're targeting a large audience, that a user could customize their regional settings or have their system setup using a different region. 即使您的应用仅在美国使用,但如果您将目标受众定位为大量受众,则总是有机会用户可以自定义区域设置或使用其他区域进行系统设置。

Using InvariantCulture will be safe no matter what you're user does. 无论您做什么,使用InvariantCulture都是安全的。 Given that this is setting an "id", I, personally, would most likely force the culture to InvariantCulture in order to guarantee that I won't get a strange result later. 考虑到这设置了一个“ id”,我个人很可能将文化强制为InvariantCulture ,以确保以后不会得到奇怪的结果。

This also makes it easier in the future to support other regions... You never know what will happen later with your code, whether in this application or in others. 这也使将来支持其他区域变得更加容易...无论以后在此应用程序中还是在其他应用程序中,您都不知道以后代码会发生什么。

Also - since you're using ReSharper, it's already warning you about this. 另外-由于您使用的是ReSharper,因此已经在警告您。 You're already there. 你已经在那里了。 It's actually easier to comply with good coding standards than it would be to ignore the warning, which makes it difficult to think of a reason NOT to specify the culture. 遵守良好的编码标准实际上比忽略警告要容易得多,这使得很难考虑不指定文化的原因。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我应该关心游戏中的课程数量吗? - Should I care about the number of classes in my game? 我何时应该在CultureInfo中设置国家/地区代码 - When should I care setting the country code in the CultureInfo 我应该在哪里更改/设置WPF应用程序中的区域性信息设置,为什么? (必须适用于所有.NET Framework 4.0和更高版本) - Where should I change/set culture info settings in my WPF app and why? (Must works on all .NET frameworks 4.0 and newer) 我什么时候应该使用中性文化? 这有什么必要? 为什么不强制使用特定文化? - When should I use Neutral culture? What is the necessary for it? why not force using Specific Culture? 什么时候应该关注在开始下一个方法之前完成一个方法? - When should one care about finishing one method before start next one? 在哪种情况下,我不应该在意Visual Studio的代码度量标准中的可维护性指数? - In what kind of situations should I not care about the Maintainability Index in Visual Studio's Code Metrics? 为什么我会得到“文化不受支持”以及什么,如果有什么,我该怎么办呢? - Why do I get, “Culture is not supported” and What, if Anything, Should I Do about it? 当在控制器上设置SessionStateBehavior.ReadOnly时,为什么还能写入会话?我应该关心吗? - Why can I still write to session when SessionStateBehavior.ReadOnly is set on a controller and should I care? C#属性重构-我应该关心吗? - C# property refactoring - Should I care? 什么是温莎城堡,我为什么要关心? - What is Castle Windsor, and why should I care?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM