Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

intAn 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
0
. Safe to use as a dictionary key.
Use 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; } }}