Skip to content

ListOutput Control

Iuga Alexandru edited this page Jan 7, 2018 · 2 revisions

Description

Displays a list of items to the Console output.

Features

  • Optional label - Displays a text label at the top of the list.
  • Custom color for the label - The label can be written with different foreground and background colors.
  • Custom bullet - Displays custom bullet in front of each item.
  • Custom space amount after the bullet - Can specify the amount of space to be displayed between the bullet and the value.
  • Custom items indentation - Specify the amount of space left empty in front of the items.

Example

Static method (quick)

string[] colorNames = Enum.GetNames(typeof(ConsoleColor));
ListOutput.QuickWrite("Colors:", colors);

Result:

Instance (more power)

ListOutput colorsOutput = new ListOutput();

colorsOutput.Bullet = "#";
colorsOutput.LabelForegroundColor = ConsoleColor.Cyan;
// etc...

colorsOutput.Write("Colors:", colors);

Result:

Clone this wiki locally