随笔分类 -  C#

摘要:反射中常用方法: 1 //获取对象类型 2 One one = new One(); 3 Type t = one.GetType(); 4 5 //动态加载 6 Assembly a = Assembly.LoadFile(path); 7 //获取所有公共类 8 Type[] _tys = a... 阅读全文
posted @ 2015-05-13 17:27 李亚杰 阅读(133) 评论(0) 推荐(0)
摘要:正则式写法规则正则表达式中有很多上述的具有特别意义的字符。首先是下列字符。[ ]范围描述符。[a-z]表示从a到z之间的任意一个。\w英文字母和数字。即[0-9 A-Z a-z]。\W非英文字母和数字\s空字符,即[\t\n\r\f]。\S非空字符。\d数字,即[0-9]。\D非数字。\b词边界字符... 阅读全文
posted @ 2014-12-18 16:22 李亚杰 阅读(136) 评论(0) 推荐(0)
摘要:1 public String GetCheckString(Bitmap bitmap) { 2 UnCodebase ud = new UnCodebase(bitmap); 3 ud.GrayByPixels(); 4 ud.... 阅读全文
posted @ 2014-04-24 20:48 李亚杰 阅读(222) 评论(0) 推荐(0)
摘要:1 bool b = false; 2 for (int i = 1; i < 101; i++) 3 { 4 for (int j = 2; j < i; j++) 5 { 6 ... 阅读全文
posted @ 2014-04-23 00:19 李亚杰 阅读(635) 评论(0) 推荐(0)
摘要:1 #region 使用递归查询某路径中的文件结构 2 3 4 public static void CheckFilePath() 5 { 6 ReadFilePath(@"E:\Test",0); 7 ... 阅读全文
posted @ 2014-04-18 19:00 李亚杰 阅读(899) 评论(0) 推荐(0)
摘要:回顾复习: 1 static void Main(string[] args) 2 { 3 int[] arr = { 2, 3, 1, 5,8, 4 }; 4 5 for (int i = 0; i arr[j+1])10 ... 阅读全文
posted @ 2014-04-18 16:03 李亚杰 阅读(147) 评论(0) 推荐(0)
摘要:使用的主要方法是:File.Move(oldFileDir,newFileDir);//这个是移动文件的方法Directory.GetFiles(dir);//获取dir路径下的所有文件的全路径 1 //给文件重命名 2 private void button1_Click(object sender, EventArgs e) 3 { 4 //要重命名文件所在目录,如 E:\images 5 string dir1 = this.oldDir.Text; 6 7 //获取目录下的所有文件... 阅读全文
posted @ 2013-11-21 00:06 李亚杰 阅读(1194) 评论(0) 推荐(0)
摘要:我了解的有两种方式方式一 1 #region 方式一 2 /// 3 /// MD5加密方法 4 /// 5 /// 要加密的字符串 6 /// 加密之后的字符串 7 private string GetMD5String(string oldpwd) 8 { 9 string newPwd = string.Empty;//声明一个字符串来存放加密后的字符串10 byte[] result = Encoding.Default.G... 阅读全文
posted @ 2013-10-14 14:48 李亚杰 阅读(487) 评论(0) 推荐(0)
摘要:C#实现把简体中文转换成拼音,很强大 阅读全文
posted @ 2013-10-13 17:13 李亚杰 阅读(556) 评论(0) 推荐(0)
摘要:1 public class MailUtil 2 { 3 4 public SmtpClient smtpClient = null;// 设置smtp协议 5 public MailMessage mailMessage_mai = null; //设置邮件信息,要发送的内容 6 7 #region 发邮件 8 /// 9 /// 发邮件10 /// 11 /// 邮箱服务器名称12 /// 附件路径13 /// 发件箱地址14 ... 阅读全文
posted @ 2013-10-13 15:39 李亚杰 阅读(773) 评论(4) 推荐(0)
摘要:private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar > 0 && e.KeyChar 9 && e.KeyChar < 177)) { e.Handled = true; MessageBox.Show("姓名只能输入汉字"); } }来自王绚文老师博客 阅读全文
posted @ 2013-09-25 22:34 李亚杰 阅读(360) 评论(0) 推荐(0)