when i am using process:
var startInfo = process.StartInfo;
startInfo.FileName = @"C:\cxecute.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
is it necessary to use process.close?
when i am using process:
var startInfo = process.StartInfo;
startInfo.FileName = @"C:\cxecute.exe";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
is it necessary to use process.close?
The Process type does contain resources it frees on calls to Close and it implements IDisposable. Hence it should be treated like any other IDisposable object and have Dispose called when you are done using it.
Failing to call Dispose won't cause any direct issues with the use of the Process object though. It's not like FileStream where failing to call Close can prevent other FileStream instances over the same file. That being said, you should still call Close when you are done with it.
Process implements IDisposable. It is better to Free resource allocated by the Process.
Process.Close() - Frees all the resources that are associated with this component.
So yes if the process must be Closed/Disposed