Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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
true
if both identifiers have the same culture code, ignoring case; otherwise,
false
.

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
true
if
obj
is an identifier with the same culture code, ignoring case; otherwise,
false
.

Remarks

Returns
false
when
obj
is not a LocaleIdentifier. Otherwise, defers to LocaleIdentifier.Equals for the code comparison.
Compare 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); } }}