logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class ValueDisplayFormatter

    Renders a raw numeric value as invariant-culture display text according to a ValueDisplaySpec. Pure formatting with no engine dependencies, so it can be unit tested outside an editor/player context and shared by every module that puts a number on screen (HUD elements, leaderboard rows, results screens).

    Inheritance
    object
    ValueDisplayFormatter
    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 ValueDisplayFormatter

    Methods

    Format(double, ValueDisplayFormat)

    Formats value with a format's defaults (no padding, no grouping).

    Declaration
    public static string Format(double value, ValueDisplayFormat format)
    Parameters
    Type Name Description
    double value

    The raw value to render.

    ValueDisplayFormat format

    The format family to render with.

    Returns
    Type Description
    string

    The formatted, invariant-culture display text.

    Format(double, ValueDisplaySpec)

    Formats value according to spec. Non-finite input (NaN/Infinity) is treated as zero, so the result is always that format's zero representation (e.g. "0", "0.00", "0:00") rather than a malformed string.

    Declaration
    public static string Format(double value, ValueDisplaySpec spec)
    Parameters
    Type Name Description
    double value

    The raw value to render (a duration in seconds for the time formats).

    ValueDisplaySpec spec

    How to render it.

    Returns
    Type Description
    string

    The formatted, invariant-culture display text.

    In this article
    © 2026 Serenity. All Rights Reserved