ResourceManager.GetString Method

Definition

Returns the specified string resource for the specified culture or current UI culture.

Overloads

GetString(String)

Returns the value of the specified string resource.

GetString(String, CultureInfo)

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

GetString(String)

Returns the value of the specified string resource.

public:
 System::String ^ GetString(System::String ^ name);
public:
 virtual System::String ^ GetString(System::String ^ name);
public string GetString (string name);
public virtual string? GetString (string name);
public virtual string GetString (string name);
member this.GetString : string -> string
abstract member GetString : string -> string
override this.GetString : string -> string
Public Function GetString (name As String) As String
Public Overridable Function GetString (name As String) As String

Parameters

name
String

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.

Exceptions

The name parameter is null.

The value of the specified resource is not a string.

No usable set of resources has been found, and there are no resources for the default culture. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

Remarks

For more information about this API, see Supplemental API remarks for ResourceManager.GetString.

Thread Safety

The GetString(String) method is thread safe.

See also

Applies to

GetString(String, CultureInfo)

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

public:
 virtual System::String ^ GetString(System::String ^ name, System::Globalization::CultureInfo ^ culture);
public virtual string GetString (string name, System.Globalization.CultureInfo culture);
public virtual string? GetString (string name, System.Globalization.CultureInfo? culture);
abstract member GetString : string * System.Globalization.CultureInfo -> string
override this.GetString : string * System.Globalization.CultureInfo -> string
Public Overridable Function GetString (name As String, culture As CultureInfo) As String

Parameters

name
String

The name of the resource to retrieve.

culture
CultureInfo

An object that represents the culture for which the resource is localized.

Returns

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

Exceptions

The name parameter is null.

The value of the specified resource is not a string.

No usable set of resources has been found, and there are no resources for a default culture. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

The default culture's resources reside in a satellite assembly that could not be found. For information about how to handle this exception, see the "Handling MissingManifestResourceException and MissingSatelliteAssemblyException Exceptions" section in the ResourceManager class topic.

Remarks

For more information about this API, see Supplemental API remarks for ResourceManager.GetString.

Thread Safety

The GetString(String, CultureInfo) method is thread safe.

See also

Applies to