Represents a set of resources with a given root name.
Object
ResourceManager
[Visual Basic] Public Class ResourceManager [C#] public class ResourceManager [C++] public __gc class ResourceManager [JScript] public class ResourceManager
Using the methods of ResourceManager, a caller can obtain a ResourceSet, which represents the resources for a particular culture. The ResourceSet can then be used to access the resources, localized for that culture, by name. A caller can also access the resources for a particular culture directly through the ResourceManager via GetObject and GetString. By default, these methods return the resource for the culture determined by the current cultural settings of the thread that made the call.
Ideally, resources should be created for every culture, or at the minimum a meaningful subset of the cultures. The resource file names follow the naming convention basename.cultureName.resources. basename can be the name of the application, or depending on the granularity desired, the name of a class. cultureName is determined from Name. A resource for the neutral culture (returned by InvariantCulture) should be named basename.resource. If a subculture is specified, the naming convention for cultureName is mainCultureName-subCultureName .
For example, suppose that an assembly has several resources with the root name "MyResources"
. These resources will have names such as "MyResources.ja-jp.resources"
, "MyResources.de.resources"
, "MyResources.zh.resources"
, "MyResources.fr-be.resources"
, which contain resources respectively for Japan, Germany, China, and French (Belgium). Now suppose that a ResourceManager has been created to represent the resources with this root name. Using the ResourceManager, one could obtain a ResourceSet which encapsulates "MyResources.ja-jp.resources"
by calling GetResourceSet(new CultureInfo ("ja-jp"),
TRUE, FALSE)
. Or, if it is known that "MyResources"
contains a resource by the name "TOOLBAR_ICON"
, one could obtain the value of that resource localized for Japan by calling GetObject("TOOLBAR_ICON", new CultureInfo("ja-jp"))
.
ResourceManager is case-sensitive, i.e., resource names, resource keys, etc. are all case-sensitive.
Namespace: System.Resources
Assembly: mscorlib.dll