我应该使用哪种技术? [英] Which Technique Should I Use?

查看:69
本文介绍了我应该使用哪种技术?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想使用一些自定义消息并将其分组到一个文件中,以便将来如果更改消息,则可以在不影响代码的情况下修改消息.

我应该使用什么?

.resx(资源配置)如何比编写消息的getter属性更好.

哪个更好 ??或任何其他解决方案.


谢谢
sjs

Hi,

I want to use some custom messages and group together into one file so that in future if message changed then i can able to modify the message without affecting the code.

What should I use?

How .resx(Resource configuration) is better than writing the getter property for the message.

which is better ?? or any other solution.


Thanks
sjs

推荐答案

您有两个选择:

选项1:

您可以使用.resx文件(资源配置)来生成应用程序配置的消息.这是优选的,因为两个原因.一种是,您不必在更改消息后重新编译应用程序.另一个是,您可以使用.resx文件实现多文化和多语言消息(全球化).

选项2:

您可以使用XML 文件使用键值配置来配置所有消息,并在应用程序启动时从XML文件加载消息(每当对XML文件进行任何修改时,都必须重新加载XML文件).这使您可以完全控制消息的实现,而不必重新编译应用程序即可修改/添加任何消息.

消息的Getter属性不是一个好的选择,因为您需要为任何消息的任何更改重新编译应用程序.
You have two options:

Option1 :

You can use .resx files (Resource configurations) for making the messages of your application configuration. This is preferable because of two reasons. One is, you don''t have to re-complie your application after changing messages. Another is, you can implement multi-cultural and multi-lingual messages (Globalization) using the .resx files.

Option2:

You can use an XML file to configure all messages using key-value configurations and load the messages from the XML file at application start (You have to reload the XML file whenever any modification is done on the XML file). This gives you full control on the messages implementation and you don''t have to recompile your application for modifying/adding any message.

Getter properties for messages is not a good option because you need to recompile the application for any change of any message.


这篇关于我应该使用哪种技术?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆