随笔分类 -  C# 基础

摘要:key要16位的字符串。 public class AESHelper { /// <summary> /// AES加密 /// </summary> /// <param name="text">加密字符</param> /// <param name="key">密钥</param> /// 阅读全文
posted @ 2023-09-28 16:52 水墨晨诗 阅读(24) 评论(0) 推荐(0) 编辑
摘要:public abstract class EntityBase { private int Version { get; set; } } /// <summary> /// 当从数据库中检索出Person实体时设置Version属性。 /// </summary> public class Pe 阅读全文
posted @ 2020-06-11 11:22 水墨晨诗 阅读(181) 评论(0) 推荐(0) 编辑
摘要:原文链接 https://www.cnblogs.com/valor-xh/p/5919377.html 数字(Range.NumberFormatlocal 属性)常规:Range.NumberFormatlocal = "G/通用格式"数值:Range.NumberFormatlocal = " 阅读全文
posted @ 2020-02-24 09:43 水墨晨诗 阅读(901) 评论(0) 推荐(0) 编辑
摘要:using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;using System.IO; 需要特别引用:System.Drawing /// <summary> /// 生成随机数 /// </ 阅读全文
posted @ 2020-01-30 18:09 水墨晨诗 阅读(2010) 评论(0) 推荐(1) 编辑
摘要:HTTP1xx - 信息提示这些状态代码表示临时的响应。客户端在收到常规响应之前,应准备接收一个或多个 1xx 响应。• 100 - 继续。• 101 - 切换协议。2xx - 成功这类状态代码表明服务器成功地接受了客户端请求。• 200 - 确定。客户端请求已成功。• 201 - 已创建。• 20 阅读全文
posted @ 2020-01-12 13:22 水墨晨诗 阅读(310) 评论(0) 推荐(1) 编辑
摘要:命令模式:将一个请求封装成为一个对象,从而使你可用不同的请求对客户进行参数化,对请求排队或记录请求日志,以及支持可撤销的操作。 命令模式的优点: 1、能够较为容易的设计一个命令队列。 2、在需要的情况下,可以较为容易的将命令记入日志。 3、允许接受请求的一方决定是否要否决请求。 4、可以容易地实现对 阅读全文
posted @ 2019-10-15 09:46 水墨晨诗 阅读(103) 评论(0) 推荐(0) 编辑
摘要:原文地址:https://www.cnblogs.com/dotnet261010/category/1137015.html https://esofar.gitbooks.io/dapper-tutorial-cn/utilities/stored-procedure.html?q= 在安装的时 阅读全文
posted @ 2018-07-10 16:47 水墨晨诗 阅读(535) 评论(0) 推荐(0) 编辑
摘要:原文地址:https://blog.csdn.net/nihao198503/article/details/9204115 将代码原封不动的copy过来,只是因为有关tar的文章太少,大多都是zip的文章 /// <summary> /// 生成 ***.tar.gz 文件 /// </summa 阅读全文
posted @ 2018-05-22 11:39 水墨晨诗 阅读(4224) 评论(1) 推荐(0) 编辑
摘要:private void button1_Click(object sender, EventArgs e){ Timer timer1 = new Timer(); timer1.Interval = 1000; timer1.Enabled = truestyle="color: #000000 阅读全文
posted @ 2018-05-10 09:36 水墨晨诗 阅读(469) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System. 阅读全文
posted @ 2018-05-03 21:40 水墨晨诗 阅读(185) 评论(2) 推荐(0) 编辑
摘要:DataTable dt = SqlHelper.Query(strQuery); var data = dt.AsEnumerable().Skip((page - 1) * size).Take(pagesize); List listData = new List(); foreach (var item in data) { Model m=new Model(); ... 阅读全文
posted @ 2018-04-09 11:09 水墨晨诗 阅读(179) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; namespace Common { /// /// 封装对缓存的操作!(对缓存的操作,最重要的就是取和存) ... 阅读全文
posted @ 2018-04-01 12:11 水墨晨诗 阅读(282) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using S 阅读全文
posted @ 2018-01-14 15:30 水墨晨诗 阅读(133) 评论(0) 推荐(0) 编辑
摘要:1、向文件中写入XML XmlDocument xmlDoc = new XmlDocument();//在内存中构建一个Dom对象 XmlDeclaration xmld = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes");//指定文档声明 x 阅读全文
posted @ 2018-01-06 22:43 水墨晨诗 阅读(248) 评论(0) 推荐(0) 编辑
摘要://cmd:"regsvr32 " + dllPath(注册dll的语句) //output:string.Empty(注册后的反馈信息 ) private static void runCmd(string cmd, out string output) { string CmdPath = @"C:\Windows\System32\cmd.exe"; cmd = cmd.Trim... 阅读全文
posted @ 2018-01-03 16:25 水墨晨诗 阅读(2736) 评论(0) 推荐(0) 编辑
摘要:主要来源: 博客: https://www.cnblogs.com/rumeng/p/3785748.html 官网: http://epplus.codeplex.com/ 教程: https://riptutorial.com/zh-CN/epplus/topic/8070/%E5%BC%80% 阅读全文
posted @ 2017-12-22 14:00 水墨晨诗 阅读(461) 评论(0) 推荐(0) 编辑
摘要:三层架构解析:http://blog.csdn.net/hanxuemin12345/article/details/8544957/ 1、功能分析(点击按钮让表中的字段id=3的年龄+1) 2、根据功能确定SQL语句(update student set age=student.age+1 whe 阅读全文
posted @ 2017-12-01 16:54 水墨晨诗 阅读(196) 评论(0) 推荐(0) 编辑
摘要:1、base64 to string 2、string to base64 阅读全文
posted @ 2017-10-12 15:20 水墨晨诗 阅读(256) 评论(0) 推荐(0) 编辑
摘要:static void Main1() { //通过委托开启一个线程 Action a = Test1; a.BeginInvoke(null, null);//开启一个新的线程去执行a所引用的方法 Console.WriteLine("main");//启动方法之后,先输出了main,再输出tes 阅读全文
posted @ 2017-08-18 11:30 水墨晨诗 阅读(594) 评论(4) 推荐(0) 编辑
摘要:如果电脑上安装了chrome,那么就会把路径显示在文本框中,如果没有安装,那么代码运行到 object objResult = regSubKey.GetValue(strKey); 就会报错,进入catch。 阅读全文
posted @ 2017-04-17 14:06 水墨晨诗 阅读(1585) 评论(0) 推荐(0) 编辑