<UseRandomizedStringHashAlgorithm> Element
Determines whether the common language runtime calculates hash codes for strings on a per application domain basis.
<runtime> Element
<TimeSpan_LegacyFormatMode> Element
<UseRandomizedStringHashAlgorithm enabled=0|1 />
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Description |
|---|---|
enabled | Required attribute. Specifies whether hash codes for strings are calculated on a per application domain basis. |
enabled Attribute
Value | Description |
|---|---|
0 | The common language runtime does not compute hash codes for strings on a per application domain basis; a single algorithm is used to calculate string hash codes. This is the default. |
1 | The common language runtime computes hash codes for strings on a per application domain basis. Identical strings in different application domains and in different processes will have different hash codes. |
Child Elements
None.
Parent Elements
Element | Description |
|---|---|
configuration | The root element in every configuration file used by the common language runtime and .NET Framework applications. |
runtime | Contains information about runtime initialization options. |
By default, the StringComparer class and the StringGetHashCode method use a single hashing algorithm that produces a consistent hash code across application domains and processes. This is equivalent to setting the enabled attribute of the <UseRandomizedStringHashAlgorithm> element to 0. This is the hashing algorithm used in the .NET Framework 4.
The StringComparer class and the StringGetHashCode method can also use a different hashing algorithm that computes hash codes on a per application domain basis. As a result, hash codes for equivalent strings will differ across application domains and processes. This is an opt-in feature; to take advantage of it, you must set the enabled attribute of the <UseRandomizedStringHashAlgorithm> element to 1.