logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct ValueDisplaySpec

    A complete description of how to render one numeric value as text: the format family plus the knobs that only apply to the numeric families (decimal precision, zero padding, thousands grouping). Time formats ignore every knob — their shape is fixed by the format itself.

    Implements
    IEquatable<ValueDisplaySpec>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.Shared.Utils
    Assembly: Serenity.Shared.dll
    Syntax
    public readonly struct ValueDisplaySpec : IEquatable<ValueDisplaySpec>

    Constructors

    ValueDisplaySpec(ValueDisplayFormat, int, int, bool, StopwatchDisplayOptions)

    Creates a spec, clamping the numeric knobs into the ranges the formatter can honour.

    Declaration
    public ValueDisplaySpec(ValueDisplayFormat format, int decimalPlaces = 0, int minimumIntegerDigits = 1, bool useThousandsSeparator = false, StopwatchDisplayOptions stopwatch = default)
    Parameters
    Type Name Description
    ValueDisplayFormat format

    The format family to render with.

    int decimalPlaces

    Decimal places for the DECIMAL format.

    int minimumIntegerDigits

    Minimum zero-padded digits before the decimal point.

    bool useThousandsSeparator

    Whether to group the integer part in thousands.

    StopwatchDisplayOptions stopwatch

    How a duration is written out; ignored by the numeric formats.

    Fields

    DecimalPlaces

    Decimal places for DECIMAL. Clamped to 0..15.

    Declaration
    public readonly int DecimalPlaces
    Field Value
    Type Description
    int

    Format

    The format family to render with.

    Declaration
    public readonly ValueDisplayFormat Format
    Field Value
    Type Description
    ValueDisplayFormat

    MinimumIntegerDigits

    Minimum digits before the decimal point, zero-padded to reach it (e.g. 3 renders 7 as "007"). Clamped to 1..19.

    Declaration
    public readonly int MinimumIntegerDigits
    Field Value
    Type Description
    int

    StopwatchOptions

    How a duration is written out. Only used by STOPWATCH.

    Declaration
    public readonly StopwatchDisplayOptions StopwatchOptions
    Field Value
    Type Description
    StopwatchDisplayOptions

    UseThousandsSeparator

    Whether to group the integer part in thousands (e.g. "1,234,567").

    Declaration
    public readonly bool UseThousandsSeparator
    Field Value
    Type Description
    bool

    Properties

    Integer

    Whole numbers with no padding and no grouping.

    Declaration
    public static ValueDisplaySpec Integer { get; }
    Property Value
    Type Description
    ValueDisplaySpec

    IsTimeFormat

    Whether this spec renders a duration rather than a plain number.

    Declaration
    public bool IsTimeFormat { get; }
    Property Value
    Type Description
    bool

    Methods

    Decimal(int)

    A fixed number of decimal places, with no padding and no grouping.

    Declaration
    public static ValueDisplaySpec Decimal(int decimalPlaces)
    Parameters
    Type Name Description
    int decimalPlaces

    How many decimal places to render.

    Returns
    Type Description
    ValueDisplaySpec

    Equals(ValueDisplaySpec)

    Declaration
    public bool Equals(ValueDisplaySpec other)
    Parameters
    Type Name Description
    ValueDisplaySpec other
    Returns
    Type Description
    bool

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    Stopwatch(StopwatchDisplayOptions, int)

    A duration in seconds rendered as a stopwatch.

    Declaration
    public static ValueDisplaySpec Stopwatch(StopwatchDisplayOptions options, int decimalPlaces = 0)
    Parameters
    Type Name Description
    StopwatchDisplayOptions options

    Which units appear and what separates them.

    int decimalPlaces

    Fractional seconds to show.

    Returns
    Type Description
    ValueDisplaySpec

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    Operators

    operator ==(ValueDisplaySpec, ValueDisplaySpec)

    Declaration
    public static bool operator ==(ValueDisplaySpec left, ValueDisplaySpec right)
    Parameters
    Type Name Description
    ValueDisplaySpec left
    ValueDisplaySpec right
    Returns
    Type Description
    bool

    operator !=(ValueDisplaySpec, ValueDisplaySpec)

    Declaration
    public static bool operator !=(ValueDisplaySpec left, ValueDisplaySpec right)
    Parameters
    Type Name Description
    ValueDisplaySpec left
    ValueDisplaySpec right
    Returns
    Type Description
    bool

    Implements

    IEquatable<T>
    In this article
    © 2026 Serenity. All Rights Reserved