ResourceSet.GetObject ResourceSet.GetObject ResourceSet.GetObject ResourceSet.GetObject Method

定义

返回具有指定名称的资源对象。Returns a resource object with the specified name.

重载

GetObject(String) GetObject(String) GetObject(String) GetObject(String)

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

GetObject(String, Boolean) GetObject(String, Boolean) GetObject(String, Boolean) GetObject(String, Boolean)

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

GetObject(String) GetObject(String) GetObject(String) GetObject(String)

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

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

参数

name
String String String String

要搜索的资源的区分大小写的名称。Case-sensitive name of the resource to search for.

返回

所请求的资源。The requested resource.

异常

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

注解

资源对象的名称区分大小写。The name of the resource object is case sensitive. 对于不区分大小写的搜索, GetObject请使用。For a case-insensitive search, use GetObject.

GetObject(String, Boolean) GetObject(String, Boolean) GetObject(String, Boolean) GetObject(String, Boolean)

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

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

参数

name
String String String String

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

ignoreCase
Boolean Boolean Boolean Boolean

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

返回

所请求的资源。The requested resource.

异常

对象已关闭或已释放。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时, 此比较将成功。 GetObjectUsing the GetObject method with ignoreCase set to true, this comparison succeeds.

适用于