Basically I want 200 characters maximum to come up in Console.ReadLine() for user input before characters start being suppressed. I want it like TextBox.MaxLength except for
If you can use Console.Read(), you can loop through until you reach the 200 characters or until an enter key is entered.
StringBuilder sb = new StringBuilder();
int i, count = 0;
while ((i = Console.Read()) != 13) // 13 = enter key (or other breaking condition)
{
if (++count > 200) break;
sb.Append ((char)i);
}
EDIT
Turns out that Console.ReadKey() is preferred to Console.Read().
http://msdn.microsoft.com/en-us/library/471w8d85.aspx
There is no way to limit the text entered into ReadLine. As the MSDN article explains,
A line is defined as a sequence of characters followed by a carriage return (hexadecimal 0x000d), a line feed (hexadecimal 0x000a), or the value of the
Environment.NewLine
What you can do, is use ReadKey in a loop that does not allow going over 200, and breaks if the user keys Environment.NewLine.