-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathSample1.cs
More file actions
27 lines (22 loc) · 885 Bytes
/
Sample1.cs
File metadata and controls
27 lines (22 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using InquirerCore;
using InquirerCore.Prompts;
using InquirerCore.Validators;
namespace Samples.Basic
{
public static class Sample1
{
public static void Run()
{
var numbersOnly = new RegexValidator("^[0-9]*$");
var nameInput = new Input("name", "What is your name?");
var ageInput = new Input("age", "What is your age?");
ageInput.SetValid(numbersOnly);
var passwordInput = new PasswordInput("password", "What is the password?");
var inquirer = new Inquirer(nameInput, ageInput, passwordInput);
inquirer.Ask();
System.Console.WriteLine($@"Hello {nameInput.Answer()}! Your age is {ageInput.Answer()}");
System.Console.WriteLine($@"Secret password: {passwordInput.Answer()}!");
System.Console.ReadKey();
}
}
}