最近做了一个项目,需要获取机器的CPU和memory的使用情况。花了一些时间网上搜索了一下,自己也做了些测试。总结下来,基本上2种方式:一种是用WMI(2种),另一种是用Performance counter。
1. Use WMI to create connection to the computer passing username and password. Once the connec
var connStr = ConfigurationManager.ConnectionStrings["dbconnstr"].ConnectionString;
SQLContext db = new SQLContext(connStr); //list查询 var list1 = db.GetList(s =>