Click here to Skip to main content
15,886,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900