日期:2014-05-16  浏览次数:20899 次

C# 获得系统的内存信息
using System;
using Microsoft.VisualBasic.Devices;
namespace ConsoleApplication2
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            ComputerInfo ci = new ComputerInfo();
            Console.WriteLine("系统物理内存(M):"+ci.TotalPhysicalMemory/1024/1024);
            Console.WriteLine("系统虚拟内存(M):"+ci.TotalVirtualMemory/1024/1024);
            Console.WriteLine("可用物理内存(M):"+ci.AvailablePhysicalMemory/1024/1024);
            Console.WriteLine("可用虚拟内存(M):" + ci.AvailableVirtualMemory/1024/1024);
        }
       
    }
}




参考:http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.devices.computerinfo.aspx