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.
Assembly: Serenity.Shared.dll
Syntax
public readonly struct ValueDisplaySpec : IEquatable<ValueDisplaySpec>
Constructors
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
The format family to render with.
Declaration
public readonly ValueDisplayFormat Format
Field Value
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
StopwatchOptions
How a duration is written out. Only used by STOPWATCH.
Declaration
public readonly StopwatchDisplayOptions StopwatchOptions
Field Value
UseThousandsSeparator
Whether to group the integer part in thousands (e.g. "1,234,567").
Declaration
public readonly bool UseThousandsSeparator
Field Value
Properties
Integer
Whole numbers with no padding and no grouping.
Declaration
public static ValueDisplaySpec Integer { get; }
Property Value
Whether this spec renders a duration rather than a plain number.
Declaration
public bool IsTimeFormat { get; }
Property Value
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
Equals(ValueDisplaySpec)
Declaration
public bool Equals(ValueDisplaySpec other)
Parameters
Returns
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
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
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
operator ==(ValueDisplaySpec, ValueDisplaySpec)
Declaration
public static bool operator ==(ValueDisplaySpec left, ValueDisplaySpec right)
Parameters
Returns
operator !=(ValueDisplaySpec, ValueDisplaySpec)
Declaration
public static bool operator !=(ValueDisplaySpec left, ValueDisplaySpec right)
Parameters
Returns
Implements