适当地创建
Process对象集时
StartInfo:
var proc = new Process { StartInfo = new ProcessStartInfo { FileName = "program.exe", Arguments = "command line arguments to your executable", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true }};然后开始该过程并从中读取:
proc.Start();while (!proc.StandardOutput.EndOfStream){ string line = proc.StandardOutput.ReadLine(); // do something with line}您可以使用
int.Parse()或
int.TryParse()将字符串转换为数字值。如果读取的字符串中包含无效的数字字符,则可能必须先进行一些字符串操作。



