代码改变世界

C#设置System.Net.ServicePointManager.DefaultConnectionLimit,突破Http协议的并发连接数限制

2016-09-26 12:37 by newbirth, 4607 阅读, 0 推荐, 收藏,
摘要:在Http协议中,规定了同个Http请求的并发连接数最大为2. 这个数值,可谓是太小了。 而目前的浏览器,已基本不再遵循这个限制,但是Dot Net平台上的 System.Net 还是默认遵循了这个标准的。 从而造成了,在使用HttpWebRequset 或者 WebClient 利用多线程的方式, 阅读全文

c# winform捕获全局异常,并记录日志

2016-09-23 13:55 by newbirth, 9227 阅读, 2 推荐, 收藏,
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.IO; namespace OrderSplit { static class Program { /// /// 应用程序的主入... 阅读全文

c# IE 清除缓存

2016-09-20 18:02 by newbirth, 387 阅读, 0 推荐, 收藏,
摘要:Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1); Response.Expires = 0; Response.CacheControl = "no-cache"; Response.Cache.Se... 阅读全文

c# 验证码图片生成类

2016-09-14 09:53 by newbirth, 2078 阅读, 0 推荐, 收藏,
摘要:using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System... 阅读全文

c# 字符串验证(邮箱、电话、数字、ip、身份证等)

2016-09-14 09:52 by newbirth, 686 阅读, 0 推荐, 收藏,
摘要:using System; using System.Text.RegularExpressions; namespace HuaTong.General.Utility { /// /// 字符串验证 /// public static class StringValidate { private static Regex RegN... 阅读全文

c# 系统校时工具类

2016-09-14 09:52 by newbirth, 633 阅读, 0 推荐, 收藏,
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HuaTong.General.Utility { /// /// 系统校时工具类 /// public static class SysDateTime { ... 阅读全文

c# 字符串工具类

2016-09-14 09:51 by newbirth, 1512 阅读, 0 推荐, 收藏,
摘要:using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.Linq; using System.Text; using System.Text.RegularExpressions; using Sys... 阅读全文

c# 自定义排序类(冒泡、选择、插入、希尔、快速、归并、堆排序等)

2016-09-14 09:49 by newbirth, 247 阅读, 0 推荐, 收藏,
摘要:using System; using System.Text; namespace HuaTong.General.Utility { /// /// 自定义排序类 /// public class Sorter { /// /// 交换元素位置 /// public static... 阅读全文

c# 获取随机数字/字符/时间

2016-09-14 09:48 by newbirth, 1568 阅读, 0 推荐, 收藏,
摘要:using System; using System.Text; namespace HuaTong.General.Utility { /// /// 随机字符/数字 /// public static class Randoms { static Random rd = new Random(); static D... 阅读全文

c# 汉字转拼音

2016-09-14 09:47 by newbirth, 279 阅读, 0 推荐, 收藏,
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HuaTong.General.Utility { /// /// 汉字转拼音 /// public class PinYinConverter { ... 阅读全文