摘要: 原文链接:http://www.2cto.com/kf/201301/186760.html其实他们两个都是委托【代理】的简写形式。一、【action】指定那些只有输入参数,没有返回值的委托Delegate的代码:[csharp] public delegate void myDelegate(st... 阅读全文
posted @ 2014-10-27 18:13 二哥(阿伟) 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 1.判断一个字符串是否全是数字 /// /// 判断字符串是否全是数字 /// /// /// public static bool IsNumber(string str) { ... 阅读全文
posted @ 2014-10-21 10:23 二哥(阿伟) 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 1.相加运行int a = 10;int b = 5;a= a+b;b=a-b;a=a-b;2.异或运算int a = 10;int b = 5;a ^= b;b ^= a;a ^= b;3.直接赋值b = a + (a = b) * 0; 无溢出风险a = a + b - (b = a); 有溢出... 阅读全文
posted @ 2014-10-09 12:57 二哥(阿伟) 阅读(325) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Web;using System.Web.UI.WebControls;using System.IO;using System.Data;using System.Data.Ole... 阅读全文
posted @ 2014-09-30 14:35 二哥(阿伟) 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 读文件: 1 StreamReader sr = new StreamReader(FileName, Encoding.Default); 2 string content = ""; 3 content = sr.ReadLine... 阅读全文
posted @ 2014-09-22 15:36 二哥(阿伟) 阅读(121) 评论(0) 推荐(0) 编辑
摘要: internal class WaveFile { #region 字段和属性 //文件路径 private string filepath; //文件详情对象 private FileInfo fileInfo; ... 阅读全文
posted @ 2014-09-22 15:23 二哥(阿伟) 阅读(514) 评论(0) 推荐(0) 编辑
摘要: &:与 运算 1.&操作两个bool类型的值,和&&类似。 if( fun1() & fun2() )两个函数都会执行;if( fun1() && fun2() ) 如果fun1()为false,fun2()不会执行 2.& "与"运算 操作两个int或short 类型。 0&0==0; 0&1 =... 阅读全文
posted @ 2014-04-17 17:23 二哥(阿伟) 阅读(4815) 评论(1) 推荐(2) 编辑
摘要: 核心代码摘自 http://www.codeproject.com/Articles/98346/Microsecond-and-Millisecond-NET-Timer想用c# (winform)做一个毫秒级别的计时器,发现微软自带的Timer控件经度不够。找到了这段代码,大意是用的 类 Sys... 阅读全文
posted @ 2014-04-03 16:06 二哥(阿伟) 阅读(2920) 评论(0) 推荐(0) 编辑
摘要: string path = Application.StartupPath + "\\" + "timeLenth.txt"; FileStream fs1 = new FileStream(path, FileMode.Create, FileAccess.Write);//搜索创建写入文件 StreamWriter sw = new StreamWriter(fs1); sw.Write("Content no other line"); sw.Write(" ... 阅读全文
posted @ 2014-03-13 16:49 二哥(阿伟) 阅读(2373) 评论(0) 推荐(0) 编辑
摘要: 如T为 classstudent(){ string name; int age;}按age大小排序写法一:students.Sort((student1,student2)=>student1.age-student2.age);写法二:void SortStudents(List students) { students.Sort(Comparison); } private int Comparison(student student1, student student2) { return student1.age - student2.age; } 阅读全文
posted @ 2014-03-13 09:40 二哥(阿伟) 阅读(2596) 评论(0) 推荐(0) 编辑