Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Process class in the Diagnostics namespace?

Why is the Process class part of the Diagnostics namespace?

This is a part of design of the BCL that kept me wondering for some time now. I find it kind of counter-intuitive, I fail to see the connection between Process and for instance the Debug and Trace classes.

like image 818
Henk Holterman Avatar asked Oct 11 '09 21:10

Henk Holterman


People also ask

What namespace is process in C#?

The Process class is in the System. Diagnostics namespace that has methods to run a .exe file to see any document or a webpage. The Process class provides Start methods for launching another application in the C# Programming.

What is a process class?

Process class provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process.

What does process name mean in it?

Remarks. The ProcessName property holds an executable file name, such as Outlook, that does not include the .exe extension or the path. It is helpful for getting and manipulating all the processes that are associated with the same executable file.

What is system diagnostics process start?

Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component. public: static System::Diagnostics::Process ^ Start(System::String ^ fileName, System::String ^ arguments); C# Copy. public static System.Diagnostics.


2 Answers

Well, according to the documentation, "The System.Diagnostics namespace provides classes that allow you to interact with system processes, event logs, and performance counters." So I guess by definition it fits. :-)

But yes, it does seem a bit like an overloading of terms by putting it next to things a bit more obviously diagnostics-related (tracing, performance counters).

Still, I would say that the Process class is as much about monitoring running processes as it is about starting new ones. Monitoring is generally accepted as a diagnostic activity. Furthermore, it might be less intuitive to most programmers if the framework had split up functionality pertaining to the same item in separate namespaces. So I can see the logic of including it here.

like image 57
bobbymcr Avatar answered Oct 08 '22 08:10

bobbymcr


The process class doesn't just represent a single process. It has a ton of information about the running processes on the computer. This info can be used to find problems or just get general information about your system state.

you can see the diagnostics namespace description here: http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx

and the process class description here: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx

like image 40
Scott M. Avatar answered Oct 08 '22 06:10

Scott M.