Validate<T>(TextPrompt<T>, Func<T, bool>, string) Method

Sets the validation criteria for the prompt.
public static TextPrompt<T> Validate<T>(this TextPrompt<T> obj, Func<T, bool> validator, string message = null)
Namespace
Spectre.Console
Containing Type
TextPromptExtensions

Parameters

T
The prompt result type.

Parameters

TextPrompt<T> obj
The prompt.
Func<T, bool> validator
The validation criteria.
string message
The validation error message.

Returns