Issue
.Net Standard does not expose a means to identify the parent or child processes of a given process.
Rationale
When this request was originally proposed, the use case identified was for killing a tree of processes. That use case was subsequently satisfied by providing Kill((bool entireProcessTree)).
Later feedback received on this issue suggests that there are separate use cases for exposing parent and/or child process details (see below comments).
Proposal
public partial class Process : .... {
public Process GetParentProcess() { … }
public Process[] GetChildProcesses() { ... } // returns a best-effort attempt list of immediate child processes (same children as would be affected if Kill(entireProcessTree: false) were called instead of this method
// Additional ideas. If there is interest, could also expose either or both of the following:
public bool IsParentOf(Process process) { ... }
public Process[] GetChildProcesses(bool includeAllDescendants = false) { ... } // adds param to return entire descendant pr }
Why Get* methods instead of properties? A process's parent can change. Instead of caching this value and so potentially returning incorrect (out of date) values, it seems desirable to compute and return the then-correct value each time it is requested. Per the API design guidelines, methods are preferred over properties when "calling the member twice in succession results in different results."
Issue
.Net Standard does not expose a means to identify the parent or child processes of a given process.
Rationale
When this request was originally proposed, the use case identified was for killing a tree of processes. That use case was subsequently satisfied by providing
Kill((bool entireProcessTree)).Later feedback received on this issue suggests that there are separate use cases for exposing parent and/or child process details (see below comments).
Proposal
Why
Get*methods instead of properties? A process's parent can change. Instead of caching this value and so potentially returning incorrect (out of date) values, it seems desirable to compute and return the then-correct value each time it is requested. Per the API design guidelines, methods are preferred over properties when "calling the member twice in succession results in different results."