如何检查RAM的类型 [英] How to check type of RAM

查看:85
本文介绍了如何检查RAM的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何以编程方式检查RAM的类型,即已安装的RAM是DDR1,DDR2还是DDR3.

how we can check the type of RAM programmatically, that installed RAM is DDR1,DDR2 or DDR3.

推荐答案

ConnectionOptions connection = new ConnectionOptions(); 
connection.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope scope = new ManagementScope("\\\\.\\root\\CIMV2", connection);     
scope.Connect(); 
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_PhysicalMemory");  ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);  foreach (ManagementObject queryObj in searcher.Get()) 
{    
System.Diagnostics.Debug.WriteLine("-----------------------------------");     System.Diagnostics.Debug.WriteLine("Capacity: {0}", queryObj["Capacity"]);     System.Diagnostics.Debug.WriteLine("MemoryType: {0}", queryObj["MemoryType"]); 
} 




Win32_PhysicalMemory类 [




Win32_PhysicalMemory class [^]


尝试在计算机上安装CPU-Z.它是免费软件..
try to install CPU-Z on your computer..it''s a freeware..


ConnectionOptions connection = new ConnectionOptions(); 
connection.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope scope = new ManagementScope("\\\\.\\root\\CIMV2", connection);     
scope.Connect(); 
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_PhysicalMemory");  ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);  foreach (ManagementObject queryObj in searcher.Get()) 
{    
System.Diagnostics.Debug.WriteLine("-----------------------------------");    
System.Diagnostics.Debug.WriteLine("Capacity: {0}", queryObj["Capacity"]);     System.Diagnostics.Debug.WriteLine("MemoryType: {0}", GetMemoryType(Int32.Parse(queryObj["MemoryType"].ToString()))); 

} 


以下是区分DDR1,DDR2,DDR3的方法,您可以在
上检查其他类型
WMI物理内存类型 [ ^ ]


following is method which differentiate between DDR1,DDR2,DDR3 you can check other types on
WMI Physical Memory Types[^]

public string GetMemoryType(int MemoryType)
        {
            switch (MemoryType)
            {
                case 20:
                    return "DDR";
                    break;
                case 21:
                    return "DDR-2";
                    break;
                default:
                    if (MemoryType == 0 || MemoryType > 22)
                        return "DDR-3";
                    else
                        return "Other";
                    break;

            }


这篇关于如何检查RAM的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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