Class
DurationPresenter
ConsoleMonster.Presenters
A duration in the most readable unit: 380 ms, 4.2 s, 1 m 05 s, 2 h 14 m, 3 d 4 h. Accepts TimeSpan values, or numbers in DurationPresenter.NumberUnit (seconds by default). TimeSpan.MinValue, TimeSpan.MaxValue and numbers outside the TimeSpan range show as a dash.
Inheritance
- object
- DurationPresenter
Constructors
public DurationPresenter(TimeSpan? numberUnit = null) #Creates a duration presenter.
Parameters
- numberUnit System.TimeSpan? = null
- The unit of plain numbers (default seconds).
Methods
public static string Format(TimeSpan span, CultureInfo culture) #Formats a duration with the culture's decimal separator.
Parameters
- span System.TimeSpan
- The duration.
- culture System.Globalization.CultureInfo
- The culture.
Returns
string The text.public PresentedValue Present(object? value, PresenterContext context) #Presents a value.
Parameters
- value object?
- The raw value (may be null).
- context ConsoleMonster.Presenters.PresenterContext
- Culture, clock, time zone, column statistics and the render context.
Inherited Methods
Properties
public bool Compact { get; set; } #Use compact units such as 4m 31s while retaining the ordinary formatting by default.