C#警告-使用NeutralResourcesLanguageAttribute标记程序集
我收到以下警告:
CA1824 用NeutralResourcesLanguageAttribute标记程序集
CA1824 Mark assemblies with NeutralResourcesLanguageAttribute
根据MSDN,其原因是:
According to MSDN, the cause of this is:
程序集包含基于ResX的资源,但没有对其应用System.Resources.NeutralResourcesLanguageAttribute.
An assembly contains a ResX-based resource but does not have the System.Resources.NeutralResourcesLanguageAttribute applied to it.
任何人都可以解释一下这是什么意思吗?
我不想定义特定的文化背景.
我希望它们是可定制的.
Could anyone please explain what it means?
I don't want to define a specific cultural setting.
I want them to be customisable.
NeutralResourcesLanguageAttribute
通知资源管理器用于显示主程序集中包含的资源的语言.例如.如果您对程序集进行了编码,使其包含英语资源,则在AssemblyInfo.cs中添加以下行
The NeutralResourcesLanguageAttribute
informs the resource manager of the language that was used to display resources which are contained in the main assembly. E.g. if you coded your assembly so that it contains resources which are in English, then include the following line in your AssemblyInfo.cs
[assembly: NeutralResourcesLanguage("en")]
这样,当以英语查找资源时,资源管理器将不会寻找英语的文化卫星集会,而只会使用主集会中包含的资源.这纯粹是性能优化.
This way, when looking up resources in English, the resource manager will not look for an English culture satellite assembly, but rather just use the resources contained in the main assembly. This is purely a performance optimisation.