咖啡真苦,蜜糖好甜
认认真真做事,踏踏实实写代码。。。

导航

 

2014年6月18日

摘要: 1,random(number)返回一个0~number-1之间的随机整数.参数[can shu]number代表一个整数.trace(random(5)); 阅读全文
posted @ 2014-06-18 15:18 咖啡真苦,蜜糖好甜 阅读(136) 评论(0) 推荐(0) 编辑
 

2014年3月12日

摘要: 最近遇到了在c#中如何进行动态加载dll的话,搞定了,下面介绍一下自己的步骤。 1,新建dll。 打开vs,新建project-》Class Library->项目名为testdll1.在新建的项目中,写入自己的方法,然后运行项目,之后在项目的bin/debug中找到一个 testdll1.dll文件.(一定要运行这个工程,不然在bin/debug里不能生成dll文件) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.... 阅读全文
posted @ 2014-03-12 13:29 咖啡真苦,蜜糖好甜 阅读(1285) 评论(0) 推荐(0) 编辑
 

2014年3月6日

摘要: 1,直接调用SerialPort类中的GetPortNames()方法. string[] portList = System.IO.Ports.SerialPort.GetPortNames(); // Com Port StringBuilder sb = new StringBuilder(); if (portList.Length > 1) { for (int i = 0; i < portList.Length; ++i) { string strComPortName = portList[i]; if (strComPort... 阅读全文
posted @ 2014-03-06 15:35 咖啡真苦,蜜糖好甜 阅读(448) 评论(0) 推荐(0) 编辑
 
摘要: 在程序中,调用WMI的时候,出现一个问题,就是我系统有插了两条内存条,共4G。然而自己只能在程序中查到安装内存为2G,感觉有点不淡定。这是之前的代码。 static ManagementObjectSearcher PhysicalMemory = new ManagementObjectSearcher("select * from Win32_PhysicalMemory"); // 安装内存 string hd = strInstalledMemory + String.Format("{0} GB", Convert.ToInt64(GetVal 阅读全文
posted @ 2014-03-06 12:44 咖啡真苦,蜜糖好甜 阅读(1093) 评论(0) 推荐(0) 编辑