上一页 1 ··· 349 350 351 352 353 354 355 356 357 ··· 361 下一页
摘要: 本类继承了IEnumerable接口这后,支持了简单的遍历,方法将内部的消息输出,提供了两种索引器对它进行读取,数值为索引的和字符为索引的.namespace Entity.Commons{ /// <summary> /// 通用消息序列类 /// </summary> public class VMessage : IEnumerable<string> { /// <summary> /// 是否完成 /// </summary> public bool IsComplete { get; set; } /// <summ 阅读全文
posted @ 2011-05-31 16:44 张占岭 阅读(469) 评论(2) 推荐(0) 编辑
摘要: ASHX内容: #region IHttpHandler Members public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/x-javascript"; List<User> list = new List<User>(); for (int i = 0; i < 10; i++) { list.Add(new User { UserName = "zzl" + i, Tel = &quo 阅读全文
posted @ 2011-05-27 16:47 张占岭 阅读(2525) 评论(1) 推荐(0) 编辑
摘要: JS扩展方法:通过原型prototype为JS的function扩展一个新的function<script> function Rectangle(width, height) { this.width = width; this.height = height; } //为js的一个function添加一个方法,即我们通过原型prototype为一个class添加一个method Rectangle.prototype.adds = function (rec) { if (rec instanceof Rectangle) { return (rec.width*rec.hei 阅读全文
posted @ 2011-05-26 18:04 张占岭 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 今天的主角是ref和out这两个参数!Ref和out它们是方法中的参数修饰符,有什么作用呢,其实可以这样理解,它们加上参数后会使用地址进行传递,说的明白点就是当定义变量a后,把它再作为ref或out参数进行传递到子方法,然后它的计算结果还会返回到这个变量之中.#region ref and out reference public class RefOrOut { public void Ref(ref int a) { a = a + 1; } public void Out(out int b) { b = 0; b = b + 1; } }#endregion调用代码:RefOrOut 阅读全文
posted @ 2011-05-26 15:29 张占岭 阅读(516) 评论(0) 推荐(0) 编辑
摘要: 接口与抽象类这两个家伙是被人们说的最多的东西了,在概念上我不想再多说了,我只是想把它们俩个在项目的应用上简单来说两句.接口,规定了一些必须被实现的行为,即只要是继承了接口,那么接口里的所有方法你都要继承,当然,如果有些方法对于你没有任何实现的价值,你也可以不去实现它,你抛一个这样的异常出来: /// <summary> /// 人类的行为 /// </summary> public interface PeopleEvent { /// <summary> /// 走路 /// </summary> void Walk(); /// <su 阅读全文
posted @ 2011-05-25 17:47 张占岭 阅读(367) 评论(0) 推荐(0) 编辑
上一页 1 ··· 349 350 351 352 353 354 355 356 357 ··· 361 下一页