Equals
Checks whether this identifier has the same culture code as another.
Read time 1 minuteLast updated 14 days ago
Definition
- Type: Method
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
Equals(LocaleIdentifier)
Checks whether this identifier has the same culture code as another.
public bool Equals(LocaleIdentifier other)
Parameters
The identifier to compare with this one.
Returns
Type | Description |
|---|---|
| bool | |
Remarks
Codes are compared with an ordinal, case-insensitive comparison, so "en" and "EN" are equal.
Compare two identifiers that differ only by case.
Examples
using Unity.Localization;namespace Unity.Localization.Samples{ public class LocaleIdentifierEqualsExample { public bool Run() { var a = new LocaleIdentifier("en"); var b = new LocaleIdentifier("EN"); return a.Equals(b); // True } }}
Equals(Object)
Checks whether this identifier equals another object.
public override bool Equals(object obj)
Parameters
The object to compare with this identifier.
Returns
Type | Description |
|---|---|
| bool | |
Remarks
Returns when is not a LocaleIdentifier. Otherwise, defers to LocaleIdentifier.Equals for the code comparison.
falseobjCompare against a boxed identifier.
Examples
using Unity.Localization;namespace Unity.Localization.Samples{ public class LocaleIdentifierEqualsObjectExample { public bool Run(object other) { var identifier = new LocaleIdentifier("en"); return identifier.Equals(other); } }}