I have a process p in my application, which will be closed by the user at some point while my application is still running. But I want my application to run on while p is running. How do I then dispose p after p were closed by the user?
Use p.Exited += (emitter, args) => ((Process) emitter).Dispose();
before starting p