When you are starting a process and dont care about the result is this ok?
Process.Start(xxx);
Or should you do this
using (Process.Start(xxx)){}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Looking at the implementation of the
Process.dispose(bool)method shows that it callsClose()on theProcessinstance. This in turn cleans up the native process handle so its probably not a bad idea.It also cleans up a wait handle that it uses to check if the process has exited.
Even if you don’t use the
using (...)block the finalizer will catch these resources in the end.