How do I determine if a process is associated with a System.Diagnostics.Process object?

Posted by JYelton on Stack Overflow See other posts from Stack Overflow or by JYelton
Published on 2010-05-20T23:51:53Z Indexed on 2010/05/21 0:10 UTC
Read the original article Hit count: 456

Filed under:
|

Given a particular System.Diagnostics.Process that has been assigned values to its properties .FileName and .Arguments, what is the best way to determine if it:

  1. has ever been issued a .Start() command or
  2. is currently associated with a process at all?

If .Start() was never issued, then calling .CloseMainWindow() causes an InvalidOperationException, which I'd like to avoid.

© Stack Overflow or respective owner

Related posts about c#

Related posts about process