Acabo de ver el problema que se describe a continuación. Si "Console.TreatControlCAsInput = true;", debe presionar [enter] dos veces en ReadLine().Problema TreatControlCAsInput. ¿Es esto un error?
He escrito un código de demostración a continuación. Estoy en lo cierto al suponer que este código demuestra un error en el marco .NET 4?
Console.Write("Test 1: Console.TreatControlCAsInput = false\nType \"hello\": ");
{
string readline = Console.ReadLine(); // type "hello" [enter].
Console.WriteLine("You typed: {0}", readline);
// Prints "hello".
}
Console.Write("Test 2: Console.TreatControlCAsInput = true\nType \"hello\": ");
Console.TreatControlCAsInput = true;
{
string readline = Console.ReadLine(); // type "hello" [enter].
Console.WriteLine("You typed: {0}", readline);
// Should print "hello" - but instead, you have to press [enter]
// *twice* to complete the ReadLine() command, and it adds a "\r"
// rather than a "\n" to the output (so it overwrites the original line)
}
// This bug is a fatal error, because it makes all ReadLine() commands unusable.
Console.Write("[any key to exit]");
Console.ReadKey();
¿En qué plataforma está ejecutando en este? – Oded
Podría reproducir esto en Windows 7. Ingrese parece estar haciendo la función del botón ** INICIO ** –
Lo veo reportado en 2006 donde está marcado como cerrado, por diseño. http://connect.microsoft.com/VisualStudio/feedback/details/226101/console-treatcontrolcasinput-true-breaks-readline – automatic