随笔分类 -  C#

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要:public void Excute_exe(string path,string arg) { ProcessStartInfo info = new ProcessStartInfo(); info.FileName = path; info.Arguments = arg; info.Wind 阅读全文
posted @ 2021-12-09 14:55 码农阿亮 阅读(135) 评论(0) 推荐(0)
摘要:C#.Net调用基本格式: DllImport 属性提供非托管 DLL 函数的调用信息。 [DLLImport(“DLL文件路径”)] 修饰符 extern 返回值类型 方法名称(参数列表) 如: using System.Runtime.InteropServices; [DllImport( " 阅读全文
posted @ 2021-12-09 13:23 码农阿亮 阅读(483) 评论(0) 推荐(0)
摘要://1.字节转换 float m = 5f; var btValue = BitConverter.GetBytes(m).Reverse().ToArray(); //转为原值字符串 string m1 = System.Text.Encoding.Default.GetString(btValu 阅读全文
posted @ 2021-11-29 19:33 码农阿亮 阅读(906) 评论(0) 推荐(0)
摘要:一、定义Class using System; using System.Runtime.InteropServices; using System.Text; namespace IniDemo { public class IniFile { private string m_FileName; 阅读全文
posted @ 2021-11-29 10:50 码农阿亮 阅读(103) 评论(0) 推荐(0)
摘要:private Dictionary<string, string> GenDictionary(byte[] inMsg) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); string arg= 阅读全文
posted @ 2021-11-29 10:44 码农阿亮 阅读(204) 评论(0) 推荐(0)
摘要:C#实现Array,List,Dictionary的相互转换 一、代码实例实现功能 将Array转换为List 将List转换为Array 将Array转换为Dictionary 将Dictionary转换为Array 将List转换为Dictionary 将Dictionary转换为List 二、 阅读全文
posted @ 2021-11-05 17:41 码农阿亮 阅读(430) 评论(0) 推荐(0)
摘要:文件夹以及文件的简单操作 笔记1: string fileName = ""; //判断文件夹 Directory.Exists(Path); //移动文件夹 Directory.Move(Path, Path); //判断文件 File.Exists(Path + fileName); //创建文 阅读全文
posted @ 2021-11-05 15:35 码农阿亮 阅读(206) 评论(0) 推荐(0)
摘要:.NET中正则表达式学习笔记 一、匹配字符串 NO.1 //正则1 Regex r = new Regex("abc"); // 定义一个Regex对象实例 Match m = r.Match("123abc456"); // 在字符串中匹配 if (m.Success) { //匹配 } //正则 阅读全文
posted @ 2021-11-05 15:34 码农阿亮 阅读(120) 评论(0) 推荐(0)
摘要:C#将字符串拆分成数组 string [] ArrList="".Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); 阅读全文
posted @ 2021-08-28 11:55 码农阿亮 阅读(1408) 评论(0) 推荐(0)
摘要:C#实现文件上传到服务器指定地址 一、建立连接 public string connectFTP(string vPath, string vUID, string vPassword) { string errormsg = ""; Process proc = new Process(); tr 阅读全文
posted @ 2021-08-26 09:58 码农阿亮 阅读(1112) 评论(1) 推荐(0)
摘要:线程的属性 一、IsBackground C#中线程分为前台线程和后台线程:线程创建时不做设置默认是前台线程。即线程属性 IsBackground=false; Thread.IsBackground = false;//false:设置为前台线程,系统默认为前台线程。 前台线程和后台线程区别:应用 阅读全文
posted @ 2021-08-18 14:05 码农阿亮 阅读(234) 评论(0) 推荐(0)
摘要:Json的序列化和反序列化 一、Json简介 Json(JavaScript Object Notation) 是一种轻量级的数据交换格式。它基于JS的一个子集。 Json采用完全独立于语言的文本格式。这使得Json成为理想的数据交换语言。易于人阅读和编写,同时也易于机器解析和生成。 Json简单来 阅读全文
posted @ 2021-08-18 14:02 码农阿亮 阅读(1639) 评论(0) 推荐(0)
摘要:XML文件与DataTable、Dataset互转 一、DataTable转XML #region DataTableToXml /// <summary> /// 将DataTable对象转换成XML字符串 /// </summary> /// <param name="ds">DataSet对象 阅读全文
posted @ 2021-08-18 08:51 码农阿亮 阅读(125) 评论(0) 推荐(0)
摘要:自定义模型转JSON之Newtonsoft.Json.dll 、System.Runtime.Serialization.dll和System.Web.Extensions.dll 自定义学生模型 #region 自定义学生模型 public enum Sex { 男 = 0, 女 = 1 } [S 阅读全文
posted @ 2021-08-16 19:08 码农阿亮 阅读(120) 评论(0) 推荐(0)
摘要:JSONStrToList、StrTosJSON JSONStrToList public class Obj { public string Name { get; set; } public double Price { get; set; } } 自定义模型 //json转对象、数组, 反序列 阅读全文
posted @ 2021-08-16 18:14 码农阿亮 阅读(85) 评论(0) 推荐(0)
摘要:C#实现连接数据库 一、Oracle 查询 public static DataTable QueryData() { DataTable dtResult = new DataTable(); try { using (OracleConnection oc = new OracleConnect 阅读全文
posted @ 2021-08-16 16:36 码农阿亮 阅读(304) 评论(0) 推荐(0)
摘要:C#实现MES系统导出多个页签的Excel文件 SpreadsheetLight.dll Excel.dll #region EXCEL public void DeleteFile(string FilePath) { if (!Directory.Exists(FilePath)) Direct 阅读全文
posted @ 2021-08-16 15:38 码农阿亮 阅读(497) 评论(0) 推荐(0)
摘要:C#前端画表 一、创建表 HtmlTable ht = new HtmlTable(); ht.Border = 1; ht.Width = "100%"; ht.BorderColor = "#7CBD2A"; ht.CellPadding = 0; ht.CellSpacing = 0; ht. 阅读全文
posted @ 2021-08-16 15:24 码农阿亮 阅读(229) 评论(0) 推荐(0)
摘要:JavaScript中遍历获取Json中属性值 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script type="text/javas 阅读全文
posted @ 2021-07-30 15:42 码农阿亮 阅读(188) 评论(0) 推荐(0)
摘要:Json转DataTable 简单 /// <summary> /// 将json转换为DataTable /// </summary> /// <param name="strJson">得到的json</param> /// <returns></returns> public static D 阅读全文
posted @ 2021-07-30 15:13 码农阿亮 阅读(150) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页