Skip to content

ValueOutput Control

Iuga Alexandru edited this page Sep 2, 2018 · 2 revisions

Description

Displays a value to the Console output.

Features

  • Custom label - The label displayed before the value.
  • Writes any type of values - The ToString method is called to convert the value to a text.
  • Custom color for the label - Specify the foreground and background colors for the label.

Example

Static method (quick)

StringView.QuickWrite("Name:", "John Doe");

Result:

Instance (more power)

StringView firstNameView = new StringView("First Name:");
firstNameView.Label.ForegroundColor = ConsoleColor.DarkGreen;

StringView lastNameView = new StringView("Last Name:");
lastNameView.Label.ForegroundColor = ConsoleColor.DarkGreen;

Int32View ageView = new Int32View("Age:");
ageView.Label.ForegroundColor = ConsoleColor.DarkGreen;


firstNameView.Value = "Joe";
firstNameView.Write();

lastNameView.Value = "Doe";
lastNameView.Write();

ageView.Value = 25;
ageView.Write();

Result:

Clone this wiki locally