System.Resources.ResourceManager.GetString Method

Returns the value of the specified string resource.

Syntax

public virtual string GetString (string name)

Parameters

name
The name of the resource to retrieve.

Returns

The value of the resource localized for the caller's current UI culture, or null if name cannot be found in a resource set.

Remarks

Desktop Apps

In desktop apps, the resource that is returned is localized for the UI culture of the current thread, as defined by the System.Globalization.CultureInfo.CurrentUICulture property. If the resource has not been localized for that culture, the resource manager probes for a resource by following the steps outlined in the "Resource Fallback Process" section of the Packaging and Deploying Resources article. If no usable set of localized resources is found, the resource manager falls back on the default culture's resources. If the resource manager cannot load the default culture's resource set, the method throws a System.Resources.MissingManifestResourceException exception or, if the resource set is expected to reside in a satellite assembly, a System.Resources.MissingSatelliteAssemblyException exception. If the resource manager can load an appropriate resource set but cannot find a resource named name, the method returns null.

The ResourceManager.IgnoreCase property determines whether the comparison of name with the names of resources is case-insensitive (the default) or case-sensitive.

Note:

This method can throw more exceptions than are listed. One reason this might occur is if a method that this method calls throws an exception. For example, a System.IO.FileLoadException exception might be thrown if an error was made deploying or installing a satellite assembly, or a System.Runtime.Serialization.SerializationException exception might be thrown if a user-defined type throws a user-defined exception when the type is deserialized.

win8_appname_long Apps

Note:

Although the System.Resources.ResourceManager class is supported in win8_appname_long apps, we do not recommend its use. Use this class only when you develop net_portable projects that can be used with win8_appname_long apps. To retrieve resources from win8_appname_long apps, use the tp://go.microsoft.com/fwlink/p/?LinkId=238182 class instead.

In win8_appname_long apps, the ResourceManager.GetString(string) method returns the value of the name string resource, localized for the caller's current UI culture settings. The list of cultures is derived from the operating system's preferred UI language list. If the resource manager cannot match name, the method returns null.

Requirements

Namespace: System.Resources
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0