What are the differences between Process.Close() and Process.Dispose()?
From documentation of Process.Close()
;
The
Dispose
method callsClose
. Placing theProcess
object in ausing
block disposes of resources without the need to callClose
.
That means, there is no difference. Internally, all Close
methods in .NET calls Dispose
method as far as I know.
If you look at reference source;
public void Close()
{
...
m_processHandle.Close();
...
}
and this method calls;
public void Close() {
Dispose(true);
}
You should always use using
statement for a Process
object. It allows early cleanup of resources so you don't need to wait until they garbage collected.