0
我試圖通過C#中的Win32_OperatingSystem類檢索我的機器的總物理內存可用值。以下是我如何檢索此值。從Win32_ComputerSystem檢索到的總物理內存與DirectX工具值不匹配
ManagementClass mc = new ManagementClass("Win32_ComputerSystem");
ManagementObjectCollection moc = mc.GetInstances();
if (moc.Count != 0)
{
foreach (ManagementObject MO in mc.GetInstances())
{
try
{
computerSystemDetails["TotalPhysicalMemory"] = (MO["TotalPhysicalMemory"] == null) ? new string[] { } : new string[] { MO["TotalPhysicalMemory"].ToString() };
}
catch (Exception ex)
{
logger.Error("GetSystemDetails", "Error occurred when retrieving the computer system information", ex);
}
}
}
return computerSystemDetails;
我從上面得到的值是16243 MB。但是當我使用DirectX診斷工具時,我得到的值是16384MB。這種差異的解釋是什麼?請指教。