What are the differences between Process.Close() and Process.Dispose()?

From documentation of Process.Close();

The Dispose method calls Close. Placing the Process object in a using block disposes of resources without the need to call Close.

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.

Tags:

C#

Process