Given the code below, which was an accepted answer to another question.
Is this safe to run new Processes this way or should I manage a reference to MyProcess?
It is my understanding the GC will (eventually) dispose of objects which no longer have a reference. With MyProcess going out of scope, wouldn't the Dispose() method be invoked when this reference is eventually Garbage Collected? My impression would be that it may run for a while, up until the GC does a collection.
void TestMethod()
{
Process MyProcess = new Process();
MyProcess.StartInfo = new ProcessStartInfo("app.exe");
MyProcess.StartInfo.WorkingDirectory = "";
MyProcess.StartInfo.Arguments = "some arguments";
MyProcess.Start();
}