Bewerken

Share via


ResourceSet.GetObject Method

Definition

Returns a resource object with the specified name.

Overloads

GetObject(String)

Searches for a resource object with the specified name.

GetObject(String, Boolean)

Searches for a resource object with the specified name in a case-insensitive manner, if requested.

GetObject(String)

Source:
ResourceSet.cs
Source:
ResourceSet.cs
Source:
ResourceSet.cs

Searches for a resource object with the specified name.

public:
 virtual System::Object ^ GetObject(System::String ^ name);
public virtual object? GetObject (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

Parameters

name
String

Case-sensitive name of the resource to search for.

Returns

The requested resource.

Exceptions

The name parameter is null.

The object has been closed or disposed.

Remarks

The name of the resource object is case sensitive. For a case-insensitive search, use GetObject.

Applies to

GetObject(String, Boolean)

Source:
ResourceSet.cs
Source:
ResourceSet.cs
Source:
ResourceSet.cs

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);
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

Parameters

name
String

Name of the resource to search for.

ignoreCase
Boolean

Indicates whether the case of the specified name should be ignored.

Returns

The requested resource.

Exceptions

The name parameter is null.

The object has been closed or disposed.

Remarks

If the value of the ignoreCase parameter is true, a resource with the name "Resource" is equivalent to the resource with the name "resource". 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.

For example, the Turkish alphabet has two versions of the character I: one with a dot and one without a dot. In Turkish, the character I (Unicode 0049) is considered the uppercase version of a different character ı (Unicode 0131). The character i (Unicode 0069) is considered the lowercase version of yet another character İ (Unicode 0130). 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). Using the GetObject method with ignoreCase set to true, this comparison succeeds.

Applies to