-
-
Notifications
You must be signed in to change notification settings - Fork 5
ListInput Control
Iuga Alexandru edited this page Jan 7, 2018
·
3 revisions
Reads a list of values from the Console input. It stops when an empty string is encountered.
- Optional label - Display an optional text label at the top of the list.
- Custom color for the label - The label can be written with specified foreground and background colors.
- Customizable bullet - Provide a custom bullet text that is displayed in front of each item that the user is requested to write.
- Customizable space amount after the bullet - Specify how many spaces to write between the bullet and the text that the user writes.
- Customizable items indentation - Specify the amount of space left empty in front of the items.
- Read any type of data - The control can be instantiated to rad any type of data, but will be the same for all the items. After the user writes a value, the control will attempt to automatically convert it to the required type.
- Custom error message for type validation - When the value cannot be converted into the required type, a custom error message is displayed to the user.
- Custom validation mechanism.
List<string> beverages = ListInput<string>.QuickRead("What are your prefered beverages?");
Result:
ListInput<string> beveragesInput = new ListInput<string>("What are your prefered beverages?");
beveragesInput.Bullet = "#";
beveragesInput.LabelForegroundColor = ConsoleColor.Cyan;
// etc...
List<string> beverages = beveragesInput.Read();
Result: