随笔分类 - C#
摘要:两种情况:用户模式和内核模式 一 用户模式 相当于运行自己写的程序,在里面设置线程同步 有volatile和interlocked两者方式 1 volatile static bool _stop; public static void Run() {//主线程 Task.Run(() => {//
阅读全文
摘要:效果: 点击后不得到焦点且不影响当前焦点所在位置,类似系统计算器中按钮的效果。 可以实现无焦点的按钮、复选框、单选框等控件。
阅读全文
摘要:using System; using System.Collections.Generic; using System.Runtime.InteropServices; namespace Print { class PrintStatus { public static int oldPrintId = 0; [StructLayout(L...
阅读全文
摘要:1 class People 2 { 3 public string A { get; set; } 4 public string B { get; set; } 5 public string C { get; set; } 6 7 8 public override bool Equals(o
阅读全文
摘要:一个功能,三个表达方式
阅读全文
摘要:以上有个bug:当线程数大于64个之后抛出异常 解决方法 封装一个MutipleThreadResetEvent类, (1)封装MutipleThreadResetEvent类 using System; using System.Threading; namespace ConsoleApp5 {
阅读全文
摘要://自定义对象 var payload = new {name="张三",age=110,time=DateTime.Now }; //序列化 string seriStr = Newtonsoft.Json.JsonConvert.SerializeObject(payload); ...
阅读全文
摘要:FileShare类 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; namespac
阅读全文
摘要:(1)设置快捷键并显示出来 MenuStrip ms = new MenuStrip(); ToolStripMenuItem tm1 = new ToolStripMenuItem("你好"); ToolStripMenuItem tl1 = new ToolStripMenuItem("你好1"
阅读全文
摘要:1根据sgmlReader类获得完整的html代码 /// <summary> /// 读取html页面内容 /// </summary> /// <param name="uri">网址</param> /// <returns></returns> private string GetWellF
阅读全文
摘要:Tuple<string, string, string, int, DateTime> s = new Tuple<string, string, string, int, DateTime>("a","b","c",1,DateTime.Parse("2017-8-23")); 一种class,
阅读全文
摘要:(1)发送请求的的客户端 (2)接收受进行处理的服务端 完!
阅读全文
摘要:加密时:先对string进行utf8解析成数组-->对数组进行加密-->对加密结果用base64解析成string。 那么揭秘时,对字符串的解析方式是必须要“倒”过来的,就成这样子了: 解密时:先对string进行base64解析成数组-->对数组进行解密-->对解密结果用utf8解析成string
阅读全文
摘要:(1)get 发送url请求 设置请求方式 设置请求内容格式 获得回应对象,接收流 读取流 (2)post 发送url请求 设置请求方式 设置请求内容格式 设置请求内容长度(可以不设置)(长度是byte数组的长度,不是string类型的长度) 将post数据添加到请求流中(重中之重GetReques
阅读全文
摘要:(1) (2)但是,电脑自动生成对象,在解析时并不全是能解析成功的。如下 完!
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; using System.IO; namespace ConsoleApplicatio...
阅读全文
摘要:string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"a.txt");//获得debug文件下a.txt的绝对路径
阅读全文

浙公网安备 33010602011771号