GetHashCode()
Computes a hash code for this identifier.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
public override int GetHashCode()
Returns
Type | Description |
|---|---|
| int | An integer hash code derived from the culture code. |
Remarks
Consistent with LocaleIdentifier.Equals: identifiers that compare equal produce the same hash code, because the code is hashed case-insensitively. The undefined identifier hashes to . Safe to use as a dictionary key.
0Use an identifier as a dictionary key.
Examples
using System.Collections.Generic;using Unity.Localization;namespace Unity.Localization.Samples{ public class LocaleIdentifierHashCodeExample { public void Run(LocaleIdentifier identifier) { var counts = new Dictionary<LocaleIdentifier, int>(); counts[identifier] = counts.GetValueOrDefault(identifier) + 1; } }}