ResourceSet.GetString 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回 String 具有指定名称的资源。
重载
| 名称 | 说明 |
|---|---|
| GetString(String) |
搜索 String 具有指定名称的资源。 |
| GetString(String, Boolean) |
如果请求,则以不区分大小写的方式搜索 String 具有指定名称的资源。 |
GetString(String)
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
搜索 String 具有指定名称的资源。
public:
virtual System::String ^ GetString(System::String ^ name);
public virtual string? GetString(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。
例外
参数 name 为 null.
指定的 name 资源不是 String。
对象已被关闭或释放。
适用于
GetString(String, Boolean)
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
- Source:
- ResourceSet.cs
如果请求,则以不区分大小写的方式搜索 String 具有指定名称的资源。
public:
virtual System::String ^ GetString(System::String ^ name, bool ignoreCase);
public virtual string? GetString(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
要搜索的资源的名称。
- ignoreCase
- Boolean
指示是否应忽略指定名称的事例。
返回
如果值为 .,则为资源的值 String。
例外
参数 name 为 null.
指定的 name 资源不是 String。
对象已被关闭或释放。
注解
如果参数ignoreCase值为true,则名称为“Resource”的资源等效于名称为“resource”的资源。 但是,请注意,此方法始终使用 CultureInfo.InvariantCulture不区分大小写的字符串比较。 优点是,此方法执行的不区分大小写的字符串比较的结果在所有计算机上都是相同的,而不考虑区域性。 缺点是结果与所有区域性的大小写规则不一致。
例如,土耳其字母表有两个版本的字符 I:一个带有点,一个没有点。 在土耳其,字符 I(Unicode 0049)被视为不同字符 ı(Unicode 0131)的大写版本。 字符 i (Unicode 0069) 被视为另一个字符 2(Unicode 0130)的小写版本。 根据这些大小写规则,区分大小写的字符串比较字符 i (Unicode 0069) 和 I (Unicode 0049) 对于区域性 “tr-TR” (土耳其的土耳其) 应失败。
GetString使用设置为的方法ignoreCasetrue,此比较成功。