04 2011 档案

摘要:在客户端要想 使用webservice的js对象 那么在webservice的cs文件里要加上下面这句[System.Web.Script.Services.ScriptService]具体的看这里 ,但是要想使用webservice的cs里的代码一定要加上上面这句http://www.cnblogs.com/teracy/archive/2007/09/07/885635.html 阅读全文
posted @ 2011-04-10 21:01 张土土 阅读(265) 评论(0) 推荐(0)
摘要:class Program { List<string> stringList = new List<string> {"abc","abcd","abcde","abcedf" }; static void Main(string[] args) { //Func的函数 是不能 使用 返回值为void 的函数 Func<string,string> del = (c) => { return c+"111"; }; Console.WriteLine( 阅读全文
posted @ 2011-04-10 14:07 张土土 阅读(240) 评论(0) 推荐(0)
摘要:有点像委托 但是 是委托吗 我不懂using System;using System.Collections.Generic;namespace ConsoleTest{ class Program { static void Main(string[] args) { List<Action> ls = new List<Action>(); for (int i = 0; i < 10; i++) { ls.Add(() => Console.WriteLine(i)); } foreach (Action action in ls) { action( 阅读全文
posted @ 2011-04-10 11:30 张土土 阅读(136) 评论(0) 推荐(0)
摘要:网上的众多关于反射的文章 都是 一开始 就之乎者也不是Assembly就是程序集看的哥这菜鸟 。。。。。。晕的,,,,,,那个汗先上简单的 ,运行下,一般人 先看出到 反射 的一些小用法了using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;namespace ReflectionExample{ class ReflTest1 { private string _prop1; public string Prop1 { get { re 阅读全文
posted @ 2011-04-09 18:59 张土土 阅读(173) 评论(0) 推荐(0)
摘要:EventCollection如果在单个控件中有多个事件,那么使用System.ComponentModel.EventHandlerList对事件进行保存将会在内存占用上有不错的提高。EventHandlerList对一个类内发布多个事件提供了一个列表容器。下面是多个事件和使用EventHandlerList的对比示意:(汗这图看不懂什么意思)第一步是实例化一个EventHandlerList的实例:第二步是声明一个容器用于保存事件的key : private static readonly object ClickEvent = new object();最后一步是像往常一样声明一个事件 阅读全文
posted @ 2011-04-08 07:08 张土土 阅读(1205) 评论(0) 推荐(0)
摘要:LoadPostData是接口IPostBackDataHandler的方法方法一般长这样public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection) { string strOldValue = Text; string strNewValue = postCollection[this.UniqueID]; if (strOldValue == null || (strOldValue != null && !st 阅读全文
posted @ 2011-04-08 06:42 张土土 阅读(234) 评论(0) 推荐(0)
摘要:如果在 sqlserver中 字段的值是 NULL (看清楚了是NULL,而不是空‘’)那么在 C#中得到的值 不是 c#中的null 而是System.DBNull现在数据库中一条用户名名为admin 记录 的Region字段的值为NULL那么得到的结果 是dt的行为1 得到的类型是 对一个System.DBNull实例装箱的object至于System.DBNull到底是什么东西 网上多的是这里记录的目的 主要是记住 在数据库中得到的 字段值 永远不会是null ,在日常项目中一定要记住不要 使用dt.Rows[0][0]==null这样 的判断语句dt.Rows[0][0].ToStri 阅读全文
posted @ 2011-04-06 21:31 张土土 阅读(4320) 评论(0) 推荐(0)