在C sharp.net中获取硬件信息 [英] Getting Hardware Information in C sharp.net

查看:74
本文介绍了在C sharp.net中获取硬件信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

有什么办法可以在c sharp.net中获取计算机的硬件信息.



显卡
RAM
处理器
硬盘空间.

任何帮助将不胜感激.

谢谢

问候.

Hello,

Is there any way to get computer''s hardware information in c sharp.net.

i.e

Graphics Card
RAM
Processor
HDD Space.

Any help would be highly appreciated.

Thanks

Regards.

推荐答案

Google是您的朋友:很好,经常拜访他.与在这里发布问题相比,他可以更快地回答问题.

使用您的主题作为搜索词的快速搜索 带来了2500万次匹配:在C#中检索硬件信息 [ ^ ]

将来,请尝试至少自己进行基础研究,不要浪费您的时间或我们的时间.
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

A very quick search using your subject as the search term gave 25 million hits: Google[^]
The first was this question, the second was an article on this site: Retrieving Hardware Information in C#[^]

In future, please try to do at least basic research yourself, and not waste your time or ours.


这是您可以使用的另一篇CodeProject文章:
如何获取硬件信息(CPU ID,主板信息,硬盘序列号,系统信息...) [
This is another CodeProject article you could use:
How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^].

How come you could not find any?



In response to the follow-up discussion:

Yes, graphic card information is missing from this article, but here is what I just came up with:
ManagementObjectSearcher managementObjectSearcher
     = new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");
string graphicCardInfo = string.Empty;
foreach (ManagementObject managementObject in managementObjectSearcher.Get()) {
    foreach (PropertyData property in managementObject.Properties) {
        if (property.Value != null)
            graphicCardInfo += string.Format("{0}: {1}{2}",
                property.Name,
                property.Value.ToString(),
                System.Environment.NewLine);
        else
            graphicCardInfo += string.Format("{0}: [UNSUPPORTED]{1}",
                property.Name,
                System.Environment.NewLine);
    }
}
System.Console.WriteLine(graphicCardInfo);



并不是所有的卡/驱动程序都不支持所有属性.试试吧.

—SA



Not that not all cards/drivers will support all properties. Just try it.

—SA


这篇关于在C sharp.net中获取硬件信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆