Class AbbreviationAttribute | Localization | 0.6.1-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class AbbreviationAttribute

    Allows you to specify an abbreviation for an item. Useful for Enumerations.

    Inheritance
    Object
    Attribute
    AbbreviationAttribute
    Namespace: UnityEngine.Localization.SmartFormat.Tests
    Syntax
    [AttributeUsage(AttributeTargets.Field)]
    public class AbbreviationAttribute : Attribute, _Attribute

    Constructors

    AbbreviationAttribute(String)

    Declaration
    public AbbreviationAttribute(string newAbbreviation)
    Parameters
    Type Name Description
    String newAbbreviation

    Fields

    Abbreviation

    Declaration
    public readonly string Abbreviation
    Field Value
    Type Description
    String

    Methods

    FindAbbreviation<TBaseType>(String, Boolean)

    Returns the object from the abbreviation.

    Declaration
    public static TBaseType FindAbbreviation<TBaseType>(string abbreviation, bool ignoreCase)
    Parameters
    Type Name Description
    String abbreviation
    Boolean ignoreCase
    Returns
    Type Description
    TBaseType
    Type Parameters
    Name Description
    TBaseType

    GetAbbrevation(Object)

    Returns the abbreviation from an item that should be marked with the AbbreviationAttribute.

    For example, GetAbbreviation(States.California) = "CA"

    Declaration
    public static string GetAbbrevation(object value)
    Parameters
    Type Name Description
    Object value
    Returns
    Type Description
    String

    TryFindAbbreviation<TBaseType>(String, Boolean, ref TBaseType)

    Searches for the object from the abbreviation

    Declaration
    public static bool TryFindAbbreviation<TBaseType>(string abbreviation, bool ignoreCase, ref TBaseType result)
    Parameters
    Type Name Description
    String abbreviation
    Boolean ignoreCase
    TBaseType result
    Returns
    Type Description
    Boolean
    Type Parameters
    Name Description
    TBaseType
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023