I have the sample console application whose code is given below
static void Main(string[] args)
{
Console.Writeline("Enter any value");
int x = int.Parse(Console.Readline());
if( x%2 == 0)
Console.Writeline("Even Value");
else
Console.Writeline("ODD Value");
}
I want to display the console of this app in simple window form, I have displayed the output line, but was unable to figure out sending input to the console application, the code for window form
var info= new ProcessStartInfo("console.exe")
{
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
}
string line="";
using (Process process= Process.Start(info))
{
using (StreamReader reader = process.StandardOutput)
{
while((line = reader.Readline()) != null)
Console.Writeline(line);
}
}
int x = Console.Readline();won't compile.