为什么 Process 类位于 Diagnostics 命名空间中?

发布于 2024-08-07 15:07:12 字数 125 浏览 4 评论 0原文

为什么 Process 类是 Diagnostics 命名空间的一部分?

这是 BCL 设计的一部分,让我疑惑了一段时间。我发现这有点违反直觉,我看不到 Process 与 Debug 和 Trace 类等之间的联系。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嗼ふ静 2024-08-14 15:07:12

好吧,根据 文档,“System.Diagnostics 命名空间提供允许您与系统进程、事件日志和性能计数器交互的类。”所以我想根据定义它是合适的。 :-)

但是,是的,通过将其放在更明显与诊断相关的事物(跟踪、性能计数器)旁边,它确实看起来有点像术语重载。

尽管如此,我还是想说,Process 类不仅用于监视正在运行的进程,还用于启动新进程。监测通常被认为是一种诊断活动。此外,如果框架将与同一项目相关的功能拆分到不同的命名空间中,对于大多数程序员来说可能不太直观。所以我可以看到将其包含在这里的逻辑。

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.

怀念你的温柔 2024-08-14 15:07:12

进程类不仅仅代表单个进程。它包含大量有关计算机上正在运行的进程的信息。此信息可用于查找问题或仅获取有关系统状态的一般信息。

您可以在此处查看诊断命名空间描述:
http://msdn.microsoft.com/en-us/library/system .diagnostics.aspx

和流程类描述如下:
http://msdn.microsoft.com/en-us/library /system.diagnostics.process.aspx

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文