System.Resources.ResourceManager.GetString Method

Returns the value of the string resource localized for the specified culture.


public virtual string GetString (string name, System.Globalization.CultureInfo culture)


The name of the resource to retrieve.
An object that represents the culture for which the resource is localized.


The value of the resource localized for the specified culture, or null if name cannot be found in a resource set.


Desktop Apps

In desktop apps, if culture is null, the ResourceManager.GetString(string, System.Globalization.CultureInfo) method uses the current UI culture obtained from the System.Globalization.CultureInfo.CurrentUICulture property.

The resource that is returned is localized for the culture specified by the culture parameter. If the resource has not been localized for 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 topic. If no usable set of 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.


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


Although the System.Resources.ResourceManagerclass 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:// class instead.

In win8_appname_long apps, the ResourceManager.GetString(string, System.Globalization.CultureInfo) method returns the value of the name string resource, localized for the culture specified by the culture parameter. If the resource is not localized for the culture culture, the lookup uses the entire win8 language fallback list, and stops after looking in the default culture. If the resource manager cannot match name, the method returns null.


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