Skip to content
ConsoleMonster
Class

TextQuestionOptions

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

One validated definition for ordinary, multiline and secret text questions.

Inheritance

  • object
  • TextQuestionOptions

Usage

Explore 79 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 38

Accepted by parameters 41

Constructors

public TextQuestionOptions() #

Properties

public string Title { get; set; } #

The question.

public string? Description { get; set; } #

Help text below the question.

public string? ParameterName { get; set; } #

The caller parameter named when a non-interactive answer is missing.

public bool AsSecret { get; set; } #

Uses the secret editor, without history or defaults.

public bool Multiline { get; set; } #

Uses the multiline editor; unavailable with AsSecret.

public string? Default { get; set; } #

The default answer; setting null still explicitly supplies a default.

public string? Placeholder { get; set; } #

The hint shown while empty.

public bool Required { get; set; } #

Whether ordinary text must be nonempty.

public int MinLength { get; set; } #

The minimum accepted character count.

public int MaxLength { get; set; } #

The maximum character count for ordinary text.

public string? Pattern { get; set; } #

A pattern which the entire single-line answer must match.

public string? PatternMessage { get; set; } #

The error for an unmatched pattern.

public Func<string, string?>? Validator { get; set; } #

Returns an error, or null to accept; secrets must not be logged.

public bool PrefillDefault { get; set; } #

Puts the single-line default in the editor.

public int MaxLines { get; set; } #

Maximum lines for multiline text.

public int Height { get; set; } #

Visible multiline rows.

public bool Hidden { get; set; } #

Hides even the secret length.

public bool AllowEmpty { get; set; } #

Allows an empty secret; secrets are required by default.

public IList<string> History { get; } #

Earlier single-line answers, oldest first; forbidden for secrets.

Extension Methods

AddHistory 3 overloads
public static TextQuestionOptions AddHistory(TextQuestionOptions textQuestionOptions, string item) #

Adds an item to TextQuestionOptions.History: Earlier single-line answers, oldest first; forbidden for secrets.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
item string required
The item.

Returns

TextQuestionOptions The same instance.
public static TextQuestionOptions AddHistory(TextQuestionOptions textQuestionOptions, params string[] items) #

Adds items to TextQuestionOptions.History: Earlier single-line answers, oldest first; forbidden for secrets.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
items string[] required
The items, in order.

Returns

TextQuestionOptions The same instance.
public static TextQuestionOptions AddHistory(TextQuestionOptions textQuestionOptions, IEnumerable<string> items) #

Adds items to TextQuestionOptions.History: Earlier single-line answers, oldest first; forbidden for secrets.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
items System.Collections.Generic.IEnumerable<string> required
The items, in order.

Returns

TextQuestionOptions The same instance.
AllowEmpty 2 overloads
public static TextQuestionOptions AllowEmpty(TextQuestionOptions textQuestionOptions, bool value) #

Sets TextQuestionOptions.AllowEmpty: Allows an empty secret; secrets are required by default.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value bool required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                         // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { AllowEmpty = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().AllowEmpty(value);
public static TextQuestionOptions AllowEmpty(TextQuestionOptions textQuestionOptions) #

Sets TextQuestionOptions.AllowEmpty to true.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance to configure.

Returns

TextQuestionOptions The same instance.
AsSecret 2 overloads
public static TextQuestionOptions AsSecret(TextQuestionOptions textQuestionOptions, bool value) #

Sets TextQuestionOptions.AsSecret: Uses the secret editor, without history or defaults.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value bool required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                       // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { AsSecret = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().AsSecret(value);
public static TextQuestionOptions AsSecret(TextQuestionOptions textQuestionOptions) #

Sets TextQuestionOptions.AsSecret to true.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance to configure.

Returns

TextQuestionOptions The same instance.
public static TextQuestionOptions Configure(TextQuestionOptions textQuestionOptions, Action<TextQuestionOptions> configure) #

Assigns callbacks and related configuration without invoking delegate-valued properties.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
configure System.Action<ConsoleMonster.Interactive.TextQuestionOptions> required
Assignments applied in order.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                        // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Validator = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Configure(configured => configured.Validator = value);
public static TextQuestionOptions Default(TextQuestionOptions textQuestionOptions, string? value) #

Sets TextQuestionOptions.Default: The default answer; setting null still explicitly supplies a default.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string? required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                      // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Default = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Default(value);
public static TextQuestionOptions Description(TextQuestionOptions textQuestionOptions, string? value) #

Sets TextQuestionOptions.Description: Help text below the question.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string? required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                          // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Description = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Description(value);
public static TextQuestionOptions Height(TextQuestionOptions textQuestionOptions, int value) #

Sets TextQuestionOptions.Height: Visible multiline rows.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value int required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                     // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Height = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Height(value);
Hidden 2 overloads
public static TextQuestionOptions Hidden(TextQuestionOptions textQuestionOptions, bool value) #

Sets TextQuestionOptions.Hidden: Hides even the secret length.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value bool required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                     // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Hidden = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Hidden(value);
public static TextQuestionOptions Hidden(TextQuestionOptions textQuestionOptions) #

Sets TextQuestionOptions.Hidden to true.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance to configure.

Returns

TextQuestionOptions The same instance.
public static TextQuestionOptions MaxLength(TextQuestionOptions textQuestionOptions, int value) #

Sets TextQuestionOptions.MaxLength: The maximum character count for ordinary text.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value int required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                        // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { MaxLength = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().MaxLength(value);
public static TextQuestionOptions MaxLines(TextQuestionOptions textQuestionOptions, int value) #

Sets TextQuestionOptions.MaxLines: Maximum lines for multiline text.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value int required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                       // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { MaxLines = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().MaxLines(value);
public static TextQuestionOptions MinLength(TextQuestionOptions textQuestionOptions, int value) #

Sets TextQuestionOptions.MinLength: The minimum accepted character count.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value int required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                        // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { MinLength = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().MinLength(value);
Multiline 2 overloads
public static TextQuestionOptions Multiline(TextQuestionOptions textQuestionOptions, bool value) #

Sets TextQuestionOptions.Multiline: Uses the multiline editor; unavailable with AsSecret.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value bool required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                        // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Multiline = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Multiline(value);
public static TextQuestionOptions Multiline(TextQuestionOptions textQuestionOptions) #

Sets TextQuestionOptions.Multiline to true.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance to configure.

Returns

TextQuestionOptions The same instance.
public static TextQuestionOptions ParameterName(TextQuestionOptions textQuestionOptions, string? value) #

Sets TextQuestionOptions.ParameterName: The caller parameter named when a non-interactive answer is missing.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string? required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                            // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { ParameterName = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().ParameterName(value);
public static TextQuestionOptions Pattern(TextQuestionOptions textQuestionOptions, string? value) #

Sets TextQuestionOptions.Pattern: A pattern which the entire single-line answer must match.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string? required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                      // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Pattern = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Pattern(value);
public static TextQuestionOptions PatternMessage(TextQuestionOptions textQuestionOptions, string? value) #

Sets TextQuestionOptions.PatternMessage: The error for an unmatched pattern.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string? required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                             // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { PatternMessage = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().PatternMessage(value);
public static TextQuestionOptions Placeholder(TextQuestionOptions textQuestionOptions, string? value) #

Sets TextQuestionOptions.Placeholder: The hint shown while empty.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string? required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                          // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Placeholder = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Placeholder(value);
PrefillDefault 2 overloads
public static TextQuestionOptions PrefillDefault(TextQuestionOptions textQuestionOptions, bool value) #

Sets TextQuestionOptions.PrefillDefault: Puts the single-line default in the editor.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value bool required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                             // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { PrefillDefault = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().PrefillDefault(value);
public static TextQuestionOptions PrefillDefault(TextQuestionOptions textQuestionOptions) #

Sets TextQuestionOptions.PrefillDefault to true.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance to configure.

Returns

TextQuestionOptions The same instance.
Required 2 overloads
public static TextQuestionOptions Required(TextQuestionOptions textQuestionOptions, bool value) #

Sets TextQuestionOptions.Required: Whether ordinary text must be nonempty.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value bool required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                       // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Required = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Required(value);
public static TextQuestionOptions Required(TextQuestionOptions textQuestionOptions) #

Sets TextQuestionOptions.Required to true.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance to configure.

Returns

TextQuestionOptions The same instance.
public static TextQuestionOptions Title(TextQuestionOptions textQuestionOptions, string value) #

Sets TextQuestionOptions.Title: The question.

Parameters

textQuestionOptions ConsoleMonster.Interactive.TextQuestionOptions required
The instance.
value string required
The value.

Returns

TextQuestionOptions The same instance.

Examples

// C# initializer or property                                                    // C# fluent
new global::ConsoleMonster.Interactive.TextQuestionOptions { Title = value };    Ui.Options<global::ConsoleMonster.Interactive.TextQuestionOptions>().Title(value);