随笔分类 -  .NET

[转].Net多线程总结
摘要:.Net提供了许多多线程编程工具,可能是因为太多了,所以掌握起来总是有一些头疼,我在这里讲讲我总结的一些多线程编程的经验,希望对大家有帮助不需要传递参数,也不需要返回参数我们知道启动一个线程最直观的办法是使用Thread类,具体步骤如下ThreadStart threadStart=new ThreadStart(Calculate);Thread thread=new Thread(thread... 阅读全文

posted @ 2007-12-01 23:04 林晓可 阅读(310) 评论(0) 推荐(0)

汉字转拼音缩写的函数
摘要:/**//// 汉字转拼音缩写 /// /// 要转换的汉字字符串 /// 拼音缩写 public string GetPYString(string str) { string tempStr = ""; foreach(char c in str) { if((int)c ... 阅读全文

posted @ 2007-03-14 17:40 林晓可 阅读(284) 评论(0) 推荐(0)

(.net 2.0)建立新线程时传入参数
摘要:在之前的1.1版本中,如果要往新建的线程中传入参数会是一件有点麻烦的事情,到了2.0中,由于有了“ParameterizedThreadStart 委托 ”的加入,使参数的传入变得简单起来。 static void Main(string[] args) { Program instance = new Program(); Thread ... 阅读全文

posted @ 2006-09-28 17:37 林晓可 阅读(403) 评论(0) 推荐(0)

asp.net 中对cookie的中文编码操作
摘要:写入时:HttpCookie cookie = new HttpCookie("cookie1");cookie.Value = Server.UrlEncode(strValue);Response.Cookies.Add(cookie); 读出时:string result = Server.UrlDecode(Request.Cookies["cookie1"].Value) 阅读全文

posted @ 2006-09-25 17:00 林晓可 阅读(940) 评论(1) 推荐(0)

asp.net设置默认按钮的方法
摘要:首先在代码中加入如下方法: /// /// 设置在页面回车时触发事件的控件 /// /// 将触发事件的控件对象 public static void SetEnterControl(System.Web.UI.Control Ctrl) { Page mPage = Ctrl.Page; string mScript; mScript = @""; ... 阅读全文

posted @ 2006-09-12 17:03 林晓可 阅读(292) 评论(0) 推荐(0)

[转]C#用SHA对密码加密
摘要:原文地址: http://ainux.blog.hexun.com/2815875_d.html现在加密技术很多,比如SHA,MD5(已经被破解了),小可想和大家讨论一下在.NET框架中简单应用SHA算法加密用户登录密码的方法。这里我采用的是SHA1(安全散列算法),是将不定长的字符串转换成160位(20字节)字节流散列算法。这里讲的加密一般分以下几个步骤: 密码的建立:1)对用户的原始密码进行... 阅读全文

posted @ 2006-07-05 09:58 林晓可 阅读(3142) 评论(0) 推荐(0)

通过需要授权访问的http读取xml文件
摘要:有时候读取的xml位于一个需要授权才能访问的http站点上 读取最简单可以使用以下方法: request=(HttpWebRequest)WebRequest.Create(url); request.Method="GET"; request.Credentials=newNetworkCredential(form.username,form.password... 阅读全文

posted @ 2005-04-30 15:35 林晓可 阅读(527) 评论(1) 推荐(0)

导航