Reputation: 23
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?
Upvotes: 2
Views: 245
Reputation: 519
Use p.Exited += (emitter, args) => ((Process) emitter).Dispose();
before starting p
Upvotes: 2