c# wait task finish code example
Example 1: c# start process and wait for exit code
public virtual bool Install(string InstallApp, string InstallArgs)
{
System.Diagnostics.Process installProcess = new System.Diagnostics.Process();
installProcess.StartInfo.FileName = InstallApp;
installProcess.StartInfo.Arguments = InstallArgs;
installProcess.Start();
installProcess.WaitForExit();
return (installProcess.ExitCode == 0) ? true : false;
}
Example 2: c# wait seconds
Thread.Sleep(2000);
Task.Delay(2000);