嗨,编辑此代码,但出现错误“无法使用 [] 将索引应用于第 8 行的“view_process.managmentobject”类型的表达式
什么是获取 30% 记忆的公式?
private static void DisplayTotalRam()
{
string Query = "SELECT MaxCapacity FROM Win32_PhysicalMemoryArray";
ManagementObjectSearcher searcher = new ManagementObjectSearcher(Query);
int amount = 0;
foreach (ManagementObject memo in searcher.Get())
{
amount += Convert.ToInt32(Convert.ToInt64(memo["Capacity"]) / 1024 / 1024 / 1024);
}
}