简体   繁体   English

资源文件与静态类,用于不需要在C#中本地化的值

[英]Resource File vs Static Class for values that will not need to be localized in C#

I overheard two of my coworkers debating this topic and I was wondering what the general thought is. 我无意中听到了两位同事在辩论这个话题,我想知道一般的想法是什么。

Right now in our application we use a lot of key value pairs and they are looking for the best way to implement a solution that would avoid us to remember the spelling for the key. 现在,在我们的应用程序中,我们使用了许多键值对,他们正在寻找实现解决方案的最佳方法,以避免我们记住密钥的拼写。

A resource file generates static class behind the scenes to access those resources so you end up basically with the same thing. 资源文件在后台生成静态类以访问这些资源,因此您基本上会使用相同的东西。 It's just that if you use a resource file and one day you decide to localize you are good to go. 只是如果您使用资源文件,并且有一天您决定本地化,那么您很高兴。 Of course there is no definite answer to this question. 当然,这个问题没有明确的答案。 Looks subjective to me as both solutions are perfectly viable. 对我来说看起来是主观的,因为这两种解决方

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM