<NetFx45_CultureAwareComparerGetHashCode_LongStrings > 元素<NetFx45_CultureAwareComparerGetHashCode_LongStrings> Element

指定运行时是否使用固定的内存量来计算 StringComparer.GetHashCode 方法的哈希代码。Specifies whether the runtime uses a fixed amount of memory to calculate hash codes for the StringComparer.GetHashCode method.

<configuration>\<configuration>\ <runtime>\<runtime>\ <NetFx45_CultureAwareComparerGetHashCode_LongStrings><NetFx45_CultureAwareComparerGetHashCode_LongStrings>

语法Syntax

<NetFx45_CultureAwareComparerGetHashCode_LongStrings enabled="0|1">

特性和元素Attributes and Elements

下列各节描述了特性、子元素和父元素。The following sections describe attributes, child elements, and parent elements.

特性Attributes

特性Attribute 描述Description
enabled 必需的特性。Required attribute.

指定公共语言运行时是否在计算哈希代码时分配固定的内存量。Specifies whether the common language runtime allocates a fixed amount of memory when calculating hash codes.

enabled 特性enabled Attribute

Value DescriptionDescription
00 公共语言运行时为 StringComparer.GetHashCode 方法分配可变的内存量来计算哈希代码。The common language runtime allocates a variable amount of memory for the StringComparer.GetHashCode method to calculate hash codes. 这是默认设置。This is the default.
11 公共语言运行时为 StringComparer.GetHashCode 方法分配固定的内存量来计算哈希代码。The common language runtime allocates a fixed amount of memory for the StringComparer.GetHashCode method to calculate hash codes.

子元素Child Elements

无。None.

父元素Parent Elements

元素Element 描述Description
configuration 公共语言运行时和 .NET Framework 应用程序所使用的每个配置文件中的根元素。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有关运行时初始化选项的信息。Contains information about runtime initialization options.

备注Remarks

默认情况下,公共语言运行时将为 StringComparer.GetHashCode 方法分配可变的内存量,当该方法尝试计算非常大的字符串(几百万个字符以上)的哈希代码时,会引发 ArgumentExceptionBy default, the common language runtime allocates a variable amount of memory for the StringComparer.GetHashCode method, and an ArgumentException can be thrown when the method attempts to compute the hash code of very large strings (over several million characters long). 通过将此元素添加到应用程序配置文件并将其 enabled 特性设置为“1”,你可以指定 StringComparer.GetHashCode 方法使用可分配固定内存量以计算哈希代码的替代算法。By adding this element to an application configuration file and setting its enabled attribute to "1", you can specify that the StringComparer.GetHashCode method use an alternate algorithm that allocates a fixed amount of memory for the computation of hash codes.

重要

<NetFx45_CultureAwareComparerGetHashCode_LongStrings> 元素不在 Windows 8Windows 8 和更高版本中使用。The <NetFx45_CultureAwareComparerGetHashCode_LongStrings> element is not used in Windows 8Windows 8 and later versions.

请参阅See also