Chapter 39Resource Files

  • Understanding what an application resource is
  • Defining and using resources within your application
  • Defining culture-specific resources
  • Extending the default resource types

Developers often overlook the humble XML resource file, because it is often hidden by Visual Studio 2013 so as not to clutter the solution. Because its most common use is as a backing file for forms or web pages, you can write large applications without interacting directly with resource files. However, resource files are an important tool that you need to use in order to write applications that can be easily maintained and translated into other languages.

The first part of this chapter explains why resource files are important and describes the features that enable developers to work with them. The remainder of the chapter explains how you can use resource files to localize an application for different languages and cultures.

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 nonexecutable and support the running of the application through the provision of data such as location, size, and other physical properties of controls. Though 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: ...

Get Professional Visual Studio 2013 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.