<分区>
Possible Duplicate:
C# - How do you get total amount of RAM the computer has?
以下将检索有多少 ram 可用:
PerformanceCounter ramCounter;
ramCounter = new PerformanceCounter("Memory", "Available MBytes");
Console.WriteLine("Total RAM: " + ramCounter.NextValue().ToString() + " MB\n\n");
当然,我们必须使用 System.Diagnostics;类。
performancecounter 是否具有检索特定机器的 RAM 数量的功能?我不是在谈论已使用或未使用的 ram 数量。我说的是机器的 ram 数量。