[System.Console]

STDIN, STDOUT, STDERR streams.
Object –> Console

Properties

  • BufferHeight - Get or set the buffer height
  • BufferWidth
  • CursorSize - Get or set the size of the console cursor.
  • WindowHeight - Get or set the console window height
  • WindowWidth
  • WindowTop - Get or set the top position of the console window.
  • WindowsLeft - Get or set the left position of the console window.

Colors

BackgroundColor = ConsoleColor.color
ForegroundColor = ConsoleColor.color

Static Methods

  • Beep
  • Beep(n, m) - Beep at n frequency for m duration
  • Clear
  • ResetColor
  • ReadKey - Read an individual character.
  • ReadLine - Read a line of input.
  • SetBufferSize
  • SetWindowSize

Reading Input

ConsoleKeyInfo key = ReadKey();
key.Key // returns key that was pressed
key.KeyChar // returns case-sensitive character that was pressed
key.Modifiers // returns modifiers (Control, Alt, Shift)

Replace Line of Output

Console.Write("\r"); // Carrier Return; moves cursor back to position #1 on current line