40.1. What Are Resources?
A resource is any data required by an application, whether it is a string, an icon, an image, or even an audio clip. Resources are non-executable and support the running of the application through the provision of data such as location, size, and other physical properties of controls. While most resources are strings, images, audio clips, or icons, there is no reason why a resource could not be a more complex object that supports serialization.
Three types of resource files can be compiled into an application: text, resx (XML resource file), and resources (binary resource file) file formats. Whole files can also be embedded as application resources where needed. Most developers who use Visual Studio 2008 will use resx files and embedded file resources.
40.1.1. Text File Resources
Text files are the most basic sort of resource because they are limited to providing string values. In applications for which a large number of string literals need to be managed, using a simple text file can be the easiest way to do it because that way they are not cluttered among the other resources of the application.
The format of strings defined in a text resource file is a name-value pair, where the name is used to reference the resource in code, as shown in the following example:
Error_Unable_To_Connect = Unable to connect to specified server
Because each name-value pair is delimited by a new line, this character cannot be added to the string. However, C-style escape ...
Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.