You need to use Console.Read()
and Console.ReadLine()
as if you were reading user input. Pipes replace user input transparently. You can't use both easily (although I'm sure it's quite possible...).
Edit:
A simple cat
style program:
class Program
{
static void Main(string[] args)
{
string s;
while ((s = Console.ReadLine()) != null)
{
Console.WriteLine(s);
}
}
}
And when run, as expected, the output:
C:...ConsoleApplication1inDebug>echo "Foo bar baz" | ConsoleApplication1.exe
"Foo bar baz"
C:...ConsoleApplication1inDebug>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…