logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class SerenityTextEliding

    Pure string truncation for display labels too long for their control. Elides from the LEFT — keeps the tail of the string and prefixes an ellipsis — because the distinguishing part of Serenity's generated names (a specific profile, module, or variant) usually lives at the end rather than the start, so keeping the prefix instead would throw away the information the reader actually needs.

    Inheritance
    object
    SerenityTextEliding
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Shared.Utils
    Assembly: Serenity.Shared.dll
    Syntax
    public static class SerenityTextEliding

    Methods

    ElideFromLeft(string, int)

    Returns text unchanged when it already fits within maxLength. Otherwise keeps the tail and prefixes Serenity.Shared.Utils.SerenityTextEliding.EllipsisPrefix so the result never exceeds maxLength characters. A null text is treated as empty, and a non-positive maxLength always yields an empty string.

    Declaration
    public static string ElideFromLeft(string text, int maxLength)
    Parameters
    Type Name Description
    string text

    The candidate label to elide.

    int maxLength

    The maximum length of the returned string, including the ellipsis.

    Returns
    Type Description
    string
    In this article
    © 2026 Serenity. All Rights Reserved