2012年7月9日
摘要: 通过LINQ to Objects 可以使用 LINQ 直接查询任何 IEnumerable<T> 或 IQueryable<T> 集合(例如string[]、 int[] 和 List<T>),而不需要使用直接的 LINQ 提供程序或 API。一、LINQ to Objects假设有一个类型为 string 的数组,该数组包含姓名列表。下面的程序输出该字符串数组中以字符G开头的所有姓名:using System;using System.Collections.Generic;using System.Linq;using System.Text;name 阅读全文
posted @ 2012-07-09 17:17 huobaby 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 下面是使用委托实现回调的示例:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Demo_Delegate{ class Program { delegate void callbackDelegate(string Message); static void Main(string[] args) { callbackDelegate result = ResultCallback; ... 阅读全文
posted @ 2012-07-09 12:53 huobaby 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 没有返回结果的委托链接:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Demo_Delegate{ class Program { delegate void MethodsDelegate(); static void Main(string[] args) { // 首先对 methods 委托赋值,使其指向 Method1() ; // 接下来使用 += ... 阅读全文
posted @ 2012-07-09 12:23 huobaby 阅读(111) 评论(0) 推荐(0) 编辑