title: How to read very long input from console in C#?
body: <p>I need to load veeeery long line from console in C#, up to 65000 chars. Console.ReadLine itself has a limit of 254 chars(+2 for escape sequences), but I can use this:</p>
  
  <pre><code>static string ReadLine()
  {
      Stream inputStream = Console.OpenStandardInput(READLINE_BUFFER_SIZE);
      byte[] bytes = new byte[READLINE_BUFFER_SIZE];
      int outputLength = inputStream.Read(bytes, 0, READLINE_BUFFER_SIZE);
      Console.WriteLine(outputLength);
      char[] chars = Encoding.UTF7.GetChars(bytes, 0, outputLength);
      return new string(chars);
  }
  </code></pre>
  
  <p>...to overcome that limit, for up to 8190 chars(+2 for escape sequences) - unfortunately I need to enter WAY bigger line, and when READLINE_BUFFER_SIZE is set to anything bigger than 8192, error "Not enough storage is available to process this command" shows up in VS. Buffer should be set to 65536. I've tried a couple of solutions to do that, yet I'm still learning and none exceeded either 1022 or 8190 chars, how can I increase that limit to 65536? Thanks in advance.</p>