CompareInfo::GetHashCode Method (String^, CompareOptions)
Gets the hash code for a string based on specified comparison options.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- source
-
Type:
System::String^
The string whose hash code is to be returned.
- options
-
Type:
System.Globalization::CompareOptions
A value that determines how strings are compared.
| Exception | Condition |
|---|---|
| ArgumentNullException | source is null. |
The behavior of GetHashCode is dependent on its implementation, which might change from one version of the common language runtime to another, or from one .NET Framework platform to another.
Important |
|---|
If two string objects are equal, the GetHashCode method returns identical values. However, there is not a unique hash code value for each unique string value. Different strings can return the same hash code. The hash code itself is not guaranteed to be stable. Hash codes for identical strings can differ across versions of the .NET Framework and across platforms (such as 32-bit and 64-bit) for a single version of the .NET Framework. In some cases, they can even differ by application domain. As a result, hash codes should never be used outside of the application domain in which they were created, they should never be used as key fields in a collection, and they should never be persisted. |
Available since 10
.NET Framework
Available since 4.6
