อ่านในภาษาอังกฤษ แก้ไข

แชร์ผ่าน


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)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Returns the value of the specified string resource.

C#
public string GetString(string name);
C#
public virtual string? GetString(string name);
C#
public virtual string GetString(string name);

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

.NET 10 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

GetString(String, CultureInfo)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

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

C#
public virtual string GetString(string name, System.Globalization.CultureInfo culture);
C#
public virtual string? GetString(string name, System.Globalization.CultureInfo? culture);

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

.NET 10 และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0