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. 对于不区分大小写的搜索,使用GetObjectFor 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,使用名称"资源"的资源是等效于具有名称"资源"的资源。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). 使用GetObject方法替换ignoreCase设置为true,这种比较成功。Using the GetObject method with ignoreCase set to true, this comparison succeeds.

适用于