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,使用名称"资源"的资源是等效于具有名称"资源"的资源。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.InvariantCultureNote, 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.

例如,土耳其语的字母表中有两个版本的实现: 一个带有圆点的字符,另一个不带点。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) 被视为另一种字符 İ (Unicode 0130) 的小写形式。The character i (Unicode 0069) is considered the lowercase version of yet another character İ (Unicode 0130). 根据这些大小写规则,不区分大小写的字符串比较的字符 (Unicode 0069) i 和 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). 使用GetString方法替换ignoreCase设置为true,这种比较成功。Using the GetString method with ignoreCase set to true, this comparison succeeds.

适用于