我想使用 c# 使用多个线程执行应用程序
我试过如下正常方法应用程序执行怎么样?
public static void OneThread()
{
DateTime startTime = DateTime.Now;
Thread t11 = new Thread(() =>
{
for (int i = 0; i <= 5; i++)
{
var proc = new Process();
proc.StartInfo.FileName = @"C:\Users\consoleapp.exe";
proc.StartInfo.Arguments = "-v -s -a";
proc.Start();
proc.WaitForExit();
var exitCode = proc.ExitCode;
proc.Close();
}
});
t11.Start();
t11.Join();
Console.WriteLine("execution 1 thread 5 times in {0} seconds", (DateTime.Now - startTime).TotalSeconds);
}
动漫人物
相关分类