随笔分类 -  基础

委托
摘要:委托是一个类,它定义了方法的类型,使得可以将方法当作另一个方法的参数来进行传递。事件是一种特殊的委托。 1.委托的声明 (1). Delegate 匿名方法 delegate我们常用到的一种声明 Delegate至少0个参数,至多32个参数,可以无返回值,也可以指定返回值类型。 例:public d 阅读全文

posted @ 2016-06-21 14:47 象山 阅读(161) 评论(1) 推荐(0)

进制转换
摘要:1 private void Window_Loaded(object sender, RoutedEventArgs e) 2 { 3 int i = 255; 4 string str1 = Convert.ToStr... 阅读全文

posted @ 2014-12-23 11:13 象山 阅读(131) 评论(0) 推荐(0)

.Net中集合总结
摘要:ICollection接口是System.Collections命名空间中类的基接口. IDictionary和IList是扩展了ICollection的更为专业的接口。IDictionary实现是键值对的集合。IList实现是值的集合,其成员可通过索引器访问 1.只实现了ICollection接口的集合有: 1.1.Queue。先进先出队列。泛型版Queue。 1.2.Stack。后进先出栈。泛型版Stack。2.实现了IList的集合有: 2.1.Array 。充当公共语言运行时中所有数组的基类.比如int[],string[]。 2.2.ArrayList。其大小根据实际需要动态增加。. 阅读全文

posted @ 2014-03-05 17:40 象山 阅读(340) 评论(0) 推荐(0)

集合中Predicate<T>委托的使用
摘要:Predicate委托表示定义一组条件并确定指定对象是否符合这些条件的方法。或者说是用于定义要搜索的元素的条件。 Array有Array.Find(T[] array,Predicate match)方法,List有List.Find(Predicate match)方法使用该委托。 Code: 1 class Program 2 { 3 static void Main(string[] args) 4 { 5 //List.Find 6 Random r = new Random(); 7 ... 阅读全文

posted @ 2014-03-04 12:54 象山 阅读(422) 评论(0) 推荐(0)

导航