ResourceSet.GetString ResourceSet.GetString ResourceSet.GetString ResourceSet.GetString Method

定义

返回具有指定名称的 String 资源。Returns a String resource with a specified name.

重载

GetString(String) GetString(String) GetString(String) GetString(String)

搜索具有指定名称的 String 资源。Searches for a String resource with the specified name.

GetString(String, Boolean) GetString(String, Boolean) GetString(String, Boolean) GetString(String, Boolean)

如果请求的话,按照不区分大小写的方式搜索具有指定名称的 String 资源。Searches for a String resource with the specified name in a case-insensitive manner, if requested.

GetString(String) GetString(String) GetString(String) GetString(String)

搜索具有指定名称的 String 资源。Searches for a String resource with the specified name.

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

参数

name
String String String String

要搜索的资源的名称。Name of the resource to search for.

返回

当值是 String 时为资源的值。The value of a resource, if the value is a String.

异常

name 指定的资源不是 StringThe resource specified by name is not a String.

对象已关闭或已释放。The object has been closed or disposed.

GetString(String, Boolean) GetString(String, Boolean) GetString(String, Boolean) GetString(String, Boolean)

如果请求的话,按照不区分大小写的方式搜索具有指定名称的 String 资源。Searches for a String resource with the specified name in a case-insensitive manner, if requested.

public:
 virtual System::String ^ GetString(System::String ^ name, bool ignoreCase);
public virtual string GetString (string name, bool ignoreCase);
abstract member GetString : string * bool -> string
override this.GetString : string * bool -> string
Public Overridable Function GetString (name As String, ignoreCase As Boolean) As String

参数

name
String String String String

要搜索的资源的名称。Name of the resource to search for.

ignoreCase
Boolean Boolean Boolean Boolean

指示是否应忽略指定名称的大小写。Indicates whether the case of the case of the specified name should be ignored.

返回

当值是 String 时为资源的值。The value of a resource, if the value is a String.

异常

name 指定的资源不是 StringThe resource specified by name is not a String.

对象已关闭或已释放。The object has been closed or disposed.

注解

如果ignoreCase参数的值为true, 则名称为 "resource" 的资源等效于名称为 "resource" 的资源。If the value of the ignoreCase parameter is true, a resource with the name "Resource" is equivalent to the resource with the name "resource". 但请注意, 此方法始终使用CultureInfo.InvariantCulture执行不区分大小写的字符串比较。Note, however, that this method always performs case-insensitive string comparisons using CultureInfo.InvariantCulture. 其优点在于, 此方法执行的不区分大小写的字符串比较的结果在所有计算机上都是相同的, 与区域性无关。The advantage is that results of case-insensitive string comparisons performed by this method are the same on all computers regardless of culture. 缺点是结果与所有区域性的大小写规则都不一致。The disadvantage is that the results are not consistent with the casing rules of all cultures.

例如, 土耳其语字母有两个版本的字符 I: 一个带有点, 一个没有句点。For example, the Turkish alphabet has two versions of the character I: one with a dot and one without a dot. 在土耳其语中, 字符 I (Unicode 0049) 被视为不同字符ı (Unicode 0131) 的大写版本。In Turkish, the character I (Unicode 0049) is considered the uppercase version of a different character ı (Unicode 0131). 字符 i (Unicode 0069) 被视为其他字符 i (Unicode 0130) 的小写形式。The character i (Unicode 0069) is considered the lowercase version of yet another character İ (Unicode 0130). 根据这些大小写规则, i (Unicode 0069) 和 I (Unicode 0049) 字符的不区分大小写的字符串比较对于区域性 "tr-TR" (土耳其语) 应该失败。According to these casing rules, a case-insensitive string comparison of the characters i (Unicode 0069) and I (Unicode 0049) should fail for the culture "tr-TR" (Turkish in Turkey). 使用将ignoreCase方法设置为true时, 此比较将成功。 GetStringUsing the GetString method with ignoreCase set to true, this comparison succeeds.

适用于