Process.Start

  • Thread starter Thread starter Jon Berry
  • Start date Start date
J

Jon Berry

Is there any difference between using the Process.Start method and
creating a new Process and calling Start?

Process.Start(path)

vs.

Process process = new Process();
ProcessStartInfo psi = new ProcessStartInfo(path)
process.StartInfo = psi;
process.Start()
 
Jon said:
Is there any difference between using the Process.Start method and
creating a new Process and calling Start?

Process.Start(path)

vs.

Process process = new Process();
ProcessStartInfo psi = new ProcessStartInfo(path)
process.StartInfo = psi;
process.Start()

Practically none.

Reflector shows:

public static Process Start(string fileName)
{
return Start(new ProcessStartInfo(fileName));
}

public static Process Start(ProcessStartInfo startInfo)
{
Process process = new Process();
if (startInfo == null)
{
throw new ArgumentNullException("startInfo");
}
process.StartInfo = startInfo;
if (process.Start())
{
return process;
}
return null;
}

Arne
 
Is there any difference between using the Process.Start method and
creating a new Process and calling Start?

Process.Start(path)

vs.

Process process = new Process();
ProcessStartInfo psi = new ProcessStartInfo(path)
process.StartInfo = psi;
process.Start()

It shouldn't be, the static method is just a shortcut with some
default values.
 
Back
Top