
COM串口通讯基类
2022-11-17--代码优化2019-08-02--提高串口接收方法效率2019-06-26--代码优化2018-11-27--添加字节数组合并方法2018-08-11--优化串口接收速度2018-04-28--优化串口接收数据转载请保留原创地址:http://www.luofenming.com/show.aspx?id=ART2017121500002public class SerialC…
2022-11-17--代码优化2019-08-02--提高串口接收方法效率2019-06-26--代码优化2018-11-27--添加字节数组合并方法2018-08-11--优化串口接收速度2018-04-28--优化串口接收数据转载请保留原创地址:http://www.luofenming.com/show.aspx?id=ART2017121500002public class SerialC…
public DataTable CreateDataTable(){ DataTable dt = new DataTable("testTable");//创建名字testTable的DataTable DataColumn DcAutoId = new DataColumn("tId", typeof(int)); DcAutoId.AutoIncrement = true;//是否自动自增 DcAutoId.AutoIncrementSeed =…
public static string CutByteString(string str,int len){string result=string.Empty;// 最终返回的结果if(string.IsNullOrEmpty(str)) { return result; }int byteLen=System.Text.Encoding.Default.GetByteCount(str);// 单字节字符长度int charLen=str.Length;// 把字符平…
static void Main(string[] args){string str = File.ReadAllText("1.txt", Encoding.Default);MatchCollection mc = Regex.Matches(str, @"([-a-zA-Z_0-9.]+)@([-a-zA-Z0-9_]+(\.[a-zA-Z]+)+)");foreach (Match m in mc){Console.WriteLine(m.Value);Con…
public static void FileCopy(string source,string target){using (FileStream fileRead = new FileStream(source, FileMode.Open, FileAccess.Read)){byte[] bb = new byte[1024 * 1024 * 5];int r= fileRead.Read(bb, 0, bb.Length);using(FileStream fileWrite=new FileSt…
/// <summary> /// 取得客户端真实IP。如果有代理则取第一个非内网地址 /// </summary> public static string GetIPAddress{get{var result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];if (!string.IsNullOrEmpty(resu…
/// <summary> /// POST请求与获取结果 /// </summary> public string HttpPost(string Url, string postDataStr){HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);request.Method = "POST";request.ContentType = "applicat…
2022-02-15 更新 以下是核心代码public static string ConnectionString = "Data Source= data.db;Pooling=true;FailIfMissing=false; ";public static int ExecuteSql(string SQLString, params SQLiteParameter[] p){//原创来自 http://www.luofenming.comusing (SQLiteC…
2020-02-18 更新 实现一个delegate是很简单的,通过以下3个步骤即可实现一个delegate: 1. 声明一个delegate对象,它应当与你想要传递的方法具有相同的参数和返回值类型。 2. 创建delegate对象,并"将你想要传递的函数作为参数传入"。 3. 在要实现异步调用的地方,通过上一…
20180530更新/// summary/// 写cookie值/// /summary/// param name="strName"名称/param/// param name="strValue"值/param/// param name="strValue"过期时间(分钟)/parampublic static void WriteCookie(string strName, string strValue, int expir…