ResourceManager.IgnoreCase 属性

定义

获取或设置值,该值指示资源管理器是否允许在 GetString(String)GetObject(String) 方法中进行不区分大小写的资源查找。Gets or sets a value that indicates whether the resource manager allows case-insensitive resource lookups in the GetString(String) and GetObject(String) methods.

public:
 virtual property bool IgnoreCase { bool get(); void set(bool value); };
public virtual bool IgnoreCase { get; set; }
member this.IgnoreCase : bool with get, set
Public Overridable Property IgnoreCase As Boolean

属性值

要在资源查找过程中忽略大小写,则为 true;否则为 falsetrue to ignore case during resource lookup; otherwise, false.

注解

如果IgnoreCase属性的值为false,则名称为 "resource" 的资源与名为 "resource" 的资源不等效。If the value of the IgnoreCase property is false, a resource with the name "Resource" is not equivalent to the resource with the name "resource". 如果IgnoreCasetrue,则名称为 "resource" 的资源等效于名称为 "resource" 的资源。If IgnoreCase is true, a resource with the name "Resource" is equivalent to the resource with the name "resource". 但请注意,在为IgnoreCase true ResourceManager.GetString时,和ResourceManager.GetObject方法使用固定区域性执行不区分大小写的字符串比较。Note, however, that when IgnoreCase is true, the ResourceManager.GetString and ResourceManager.GetObject methods perform case-insensitive string comparisons by using the invariant culture. 优点是这些方法执行的不区分大小写的字符串比较的结果在所有计算机上都是相同的,与区域性无关。The advantage is that results of case-insensitive string comparisons performed by these methods 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比较将会成功。However, because the comparison is conducted by using the casing rules of the invariant culture if IgnoreCase is true, this comparison succeeds.

备注

出于性能原因,最好始终为资源名称指定正确的大小写。For performance reasons, it is best to always specify the correct case for your resource names. 设置IgnoreCasetrue可能会导致工作集大幅增加,并显著降低性能。Setting IgnoreCase to true can cause a significant increase in working set and a significant decline in performance.

适用于