文章分类 - C# 那些事儿
摘要:(1)列表头创建(记得,需要先创建列表头) ColumnHeader ch= new ColumnHeader(); ch.Text = "列标题1"; //设置列标题 ch.Width = 120; //设置列宽度 ch.TextAlign = HorizontalAlignment.Left; //设置列的对齐方式 this.listView1.Co...
阅读全文
摘要:找了很多都说DataGridView有一个属性AutoSizeColumnMode,他有很多枚举值: 1、AllCells 调整列宽,以适合该列中的所有单元格的内容,包括标题单元格。 2、AllCellsExceptHeader 调整列宽,以适合该列中的所有单元格的内容,不包括标题单元格。 3、ColumnHeader 调整列宽,以适合列标题单元格的内容。 4、DisplayedCe...
阅读全文
摘要:string类型转成byte[]: byte[] byteArray = System.Text.Encoding.Default.GetBytes ( str ); byte[]转成string: string str = System.Text.Encoding.Default.GetString ( byteArray ); string类型转成ASCII byte[]...
阅读全文
摘要:1、用法1: 常规用 增加键值对之前需要判断是否存在该键,如果已经存在该键而且不判断,将抛出异常。所以这样每次都要进行判断,很麻烦,在备注里使用了一个扩展方法 2、用法2:Dictionary的Value为一个数组 3、用法3: Dictionary的Value为一个类 4 备注:Dictionar
阅读全文
摘要:封装好的类,直接上代码:
阅读全文
摘要:加密,采用分段的方式,无长度限制: 解密,必须对应:
阅读全文
摘要:public string GetGUID() { var uuid = Guid.NewGuid().ToString(); //去掉中间“-” uuid = uuid.Replace("-", ""); //转大写 uuid = uuid...
阅读全文
摘要:/// /// 运行exe文件,或者图片、txt等 /// /// public void RunExeFile(string file) { if (File.Exists(file)) System.Diagnostics.Process.Start(file); ...
阅读全文
摘要:/// /// 取文本MD5 /// /// 文本 /// 文本MD5 public string GetTextMd5(string txt) { byte[] result = Encoding.Default.GetBytes(txt); ...
阅读全文
摘要:/// /// 字符串转整型,异常赋默认值 /// /// 字符串 /// 默认值 /// 整型值 public int StrToIntDef(string s, int defaultValue = 0) { int num; //定义一...
阅读全文
摘要:/// /// 数字转中文 /// /// eg: 22 /// public string NumberToChinese(int number) { string res = string.Empty; string str =...
阅读全文
摘要:private int ZipFile(string FileToZip, string ZipedFile, int CompressionLevel, int BlockSize) { if (!System.IO.File.Exists(FileToZip)) { return -1; ...
阅读全文
摘要:/// /// 写入值 /// /// /// public static void SetValue(string key, string value) { //增加的内容写在appSettings段下 System....
阅读全文
摘要:using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks; namespace ZentaoMailService...
阅读全文
摘要:一、string转json 二、string转jsonArray
阅读全文
摘要://把整个文件内容读入字符串变量 string path = @"d:\a.txt"; string s = System.IO.File.ReadAllText(path);
阅读全文
摘要:1、 FTP命令 FTP 协议中规定了一些大家都认识的命令和组成。FTP协议中的命令都由3~4个字母组成,命令与参数之间用空格隔开,每个命令用回车换行结束。 (1)访问命令 (1)访问命令有: USER命令——格式为:USER <username>, 指定登录的用户名,以便服务器进行身份验证。这个命
阅读全文

浙公网安备 33010602011771号