摘要: #.NET支持的类型参数约束有以下五种: where T : struct | T必须是一个结构类型 where T : class | T必须是一个Class类型 where T : new() | T必须要有一个无参构造函数 where T : NameOfBaseClass | T必须继承名为 阅读全文
posted @ 2022-07-26 21:32 码农阿亮 阅读(59) 评论(0) 推荐(0) 编辑
摘要: //序列化对象 static byte[] Serialize(MyObject obj) { //二进制序列化 IFormatter formatter = new BinaryFormatter(); using (MemoryStream ms=new MemoryStream ()) { f 阅读全文
posted @ 2022-07-26 21:12 码农阿亮 阅读(169) 评论(0) 推荐(0) 编辑
摘要: action.BeginInvoke public class Program { static void Main(string[] args) { Console.WriteLine($"********************* 系统开始 线程ID:{Thread.CurrentThread. 阅读全文
posted @ 2022-07-26 20:46 码农阿亮 阅读(40) 评论(0) 推荐(0) 编辑
摘要: C++读取文件的内容 #include<iostream> #include <string> #include <fstream> #include <sstream> using namespace std; string readAnsiTXT(string filename) { ifstr 阅读全文
posted @ 2022-07-26 20:45 码农阿亮 阅读(38) 评论(0) 推荐(0) 编辑
摘要: #常用方法 /// <summary> /// 随机数 /// </summary> /// <param name="Length">长度</param> /// <returns></returns> public static string GenerateRandomNumber(int L 阅读全文
posted @ 2022-07-26 20:43 码农阿亮 阅读(32) 评论(0) 推荐(0) 编辑
摘要: C#实现将图片黏贴到RichBox中 Bitmap bmp = new Bitmap(cache_file); //Bitmap bmp = new Bitmap(@"C:\Users\Administrator\Desktop\temp\BBGJ.png");//获得图片 //Bitmap bmp 阅读全文
posted @ 2022-07-26 20:41 码农阿亮 阅读(72) 评论(0) 推荐(0) 编辑
摘要: public class VerifyCode { /// <summary> /// 生成验证码 /// </summary> /// <returns></returns> public byte[] GetVerifyCode() { int num = 80; int num2 = 30; 阅读全文
posted @ 2022-07-26 20:25 码农阿亮 阅读(37) 评论(0) 推荐(0) 编辑
摘要: public class Net { /// <summary> /// 获取Ip /// </summary> public static string Ip { get { string text = string.Empty; bool flag = HttpContext.Current ! 阅读全文
posted @ 2022-07-26 20:18 码农阿亮 阅读(92) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 文件上传帮助类 /// </summary> public class UploadHelper { /// <summary> /// 附件上传 成功:succeed、失败:error、文件太大:-1、 /// </summary> /// <param nam 阅读全文
posted @ 2022-07-26 20:16 码农阿亮 阅读(43) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 汉字转换拼音 /// </summary> public class PinyinHelper { /// <summary> /// 将中文汉字转成拼音码 /// </summary> /// <param name="chineseStr">汉字字符</par 阅读全文
posted @ 2022-07-26 20:15 码农阿亮 阅读(28) 评论(0) 推荐(0) 编辑
摘要: public class SizeHelper { /// <summary> /// 获取文件大小并以B,KB,GB,TB方式表示 /// </summary> /// <param name="file">文件(FileInfo类型)</param> /// <returns></returns 阅读全文
posted @ 2022-07-26 20:13 码农阿亮 阅读(42) 评论(0) 推荐(0) 编辑
摘要: public class Cache { private static Cache _cache = HttpRuntime.Cache; /// <summary> /// 本地缓存获取 /// </summary> /// <param name="name">key</param> /// < 阅读全文
posted @ 2022-07-26 20:10 码农阿亮 阅读(51) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// Web操作 /// </summary> public static class WebHelper { /// <summary> /// 获取主机名,即域名, /// 范例:用户输入网址http://www.a.com/b.htm?a=1&amp;b=2, / 阅读全文
posted @ 2022-07-26 20:10 码农阿亮 阅读(38) 评论(0) 推荐(0) 编辑