Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the benefits of resource(.resx) files?

Tags:

c#

.net

vb.net

resx

What compelling reasons exist for using them?

like image 619
Newbie Avatar asked Jul 15 '09 20:07

Newbie


People also ask

What is a resources RESX file?

resx resource file format consists of XML entries, which specify objects and strings inside XML tags. It contains a standard set of header information, which describes the format of the resource entries and specifies the versioning information for the XML used to parse the data.

What is the use of resource file?

You can include resources, such as strings, images, or object data, in resources files to make them easily available to your application. The . NET Framework offers five ways to create resources files: Create a text file that contains string resources.


2 Answers

  • Resource files give you an easy way to localize/internationalize your .net applications by automatically determining which language resx file to use based on the user's locale. To add more languages, simply add another translated resource file.

  • Resource files give you a central location to store your strings, files and scripts and refer to them in a strongly-typed manner (so the compile will break if you reference them improperly).

  • Resource files can be compiled into satellite assemblies, making it easy to change up the resources in a production application without having to recompile the whole thing.

like image 172
womp Avatar answered Sep 30 '22 22:09

womp


As a supplement to the other answers, string resources are for human-readable text, not constants that will be used programmatically. They're great for error messages, button labels and the like.

Very often, rather than the final string, we store a format string so that variables can be substituted in at the last moment. The nice thing about this method is that, unlike concatenation, it's not broken when a language has different word order requirements.

like image 24
Steven Sudit Avatar answered Sep 30 '22 23:09

Steven Sudit