NumberPrompt
ConsoleMonster.Interactive
A number: whole or decimal, with a minimum and maximum shown as a hint, Up/Down stepping by NumberPrompt.Step (PgUp/PgDn by ten steps), and an inline error for text that is not a number or out of range.
Inheritance
- Prompt<decimal>
- NumberPrompt
Usage
Explore 41 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 21
- Extension method NumberPrompt.Culture
- Extension method NumberPrompt.Default
- Extension method NumberPrompt.Description
- Extension method NumberPrompt.Integer
- Extension method NumberPrompt.Maximum
- Extension method NumberPrompt.Minimum
- Extension method NumberPrompt.ParameterName
- Extension method NumberPrompt.Step
- Extension method NumberPrompt.Title
- Extension method NumberPrompt.Validate
- Method NumberPromptFluent.Culture
- Method NumberPromptFluent.Default
- Method NumberPromptFluent.Description
- Method NumberPromptFluent.Integer
- Method NumberPromptFluent.Maximum
- Method NumberPromptFluent.Minimum
- Method NumberPromptFluent.ParameterName
- Method NumberPromptFluent.Step
- Method NumberPromptFluent.Title
- Method NumberPromptFluent.Validate
- Method Ui.NumberPrompt
Accepted by parameters 20
- Extension method NumberPrompt.Culture
- Extension method NumberPrompt.Default
- Extension method NumberPrompt.Description
- Extension method NumberPrompt.Integer
- Extension method NumberPrompt.Maximum
- Extension method NumberPrompt.Minimum
- Extension method NumberPrompt.ParameterName
- Extension method NumberPrompt.Step
- Extension method NumberPrompt.Title
- Extension method NumberPrompt.Validate
- Method NumberPromptFluent.Culture
- Method NumberPromptFluent.Default
- Method NumberPromptFluent.Description
- Method NumberPromptFluent.Integer
- Method NumberPromptFluent.Maximum
- Method NumberPromptFluent.Minimum
- Method NumberPromptFluent.ParameterName
- Method NumberPromptFluent.Step
- Method NumberPromptFluent.Title
- Method NumberPromptFluent.Validate
Constructors
Methods
public override string Describe(decimal value) #The answer as text, for the summary line left in the scrollback.
Parameters
- value decimal
- The answer.
Returns
string The text.Inherited Methods
public virtual decimal Show(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Parameters
- options InteractiveOptions? = null
- cancellationToken CancellationToken = default
Returns
decimalpublic Task<decimal> ShowAsync(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Parameters
- options InteractiveOptions? = null
- cancellationToken CancellationToken = default
Returns
Task<decimal>public IWidget Snapshot(InteractiveOptions? options = null) #Parameters
- options InteractiveOptions? = null
Returns
IWidgetpublic bool TryShow(out decimal value, InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Parameters
- value decimal
- options InteractiveOptions? = null
- cancellationToken CancellationToken = default
Returns
boolProperties
Inherited Properties
public string Title { get; set; } #public string? Description { get; set; } #public string? ParameterName { get; set; } #public bool HasDefault { get; } #Extension Methods
public static NumberPrompt Culture(NumberPrompt numberPrompt, CultureInfo? value) #Sets NumberPrompt.Culture: The culture that parses and formats the number; null uses the current culture.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value System.Globalization.CultureInfo?
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Culture = value; Ui.NumberPrompt().Culture(value);public static NumberPrompt Default(NumberPrompt numberPrompt, decimal value) #Sets Prompt<decimal>.Default: The default answer: pre-selected, accepted with Enter, and returned in non-interactive sessions.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value decimal
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Default = value; Ui.NumberPrompt().Default(value);public static NumberPrompt Description(NumberPrompt numberPrompt, string? value) #Sets Prompt<decimal>.Description: Help text under the question.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Description = value; Ui.NumberPrompt().Description(value);public static NumberPrompt Integer(NumberPrompt numberPrompt, bool value = true) #Sets NumberPrompt.Integer: Whether only whole numbers are accepted.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
numberPrompt.Integer = value; Ui.NumberPrompt().Integer(value);public static NumberPrompt Maximum(NumberPrompt numberPrompt, decimal? value) #Sets NumberPrompt.Maximum: The largest accepted value.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value decimal?
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Maximum = value; Ui.NumberPrompt().Maximum(value);public static NumberPrompt Minimum(NumberPrompt numberPrompt, decimal? value) #Sets NumberPrompt.Minimum: The smallest accepted value.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value decimal?
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Minimum = value; Ui.NumberPrompt().Minimum(value);public static NumberPrompt ParameterName(NumberPrompt numberPrompt, string? value) #Sets Prompt<decimal>.ParameterName: The parameter that supplies this value non-interactively (-Domain, --domain); named in the non-interactive error message.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.ParameterName = value; Ui.NumberPrompt().ParameterName(value);public static NumberPrompt Step(NumberPrompt numberPrompt, decimal value) #Sets NumberPrompt.Step: The step of Up and Down.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value decimal
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Step = value; Ui.NumberPrompt().Step(value);public static NumberPrompt Title(NumberPrompt numberPrompt, string value) #Sets Prompt<decimal>.Title: The question.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
numberPrompt.Title = value; Ui.NumberPrompt().Title(value);public static NumberPrompt Validate(NumberPrompt numberPrompt, Func<decimal, string?>? value) #Sets NumberPrompt.Validator: A validator after range checks: returns an error message, or null.
Parameters
- numberPrompt ConsoleMonster.Interactive.NumberPrompt
- The instance.
- value System.Func<decimal, string?>?
- The callback.
Examples
// C# initializer or property // C# fluent
numberPrompt.Validator = value; Ui.NumberPrompt().Validate(value);