摘要: IEnumerable:实现IEnumerable接口的类,可以支持foreach循环遍历对象的集合元素IEnumerator GetEnumerator()返回可循环访问集合的枚举数。IEnumerator:object Current获取集合中的当前元素。bool MoveNext()将枚举数推进到集合的下一个元素。如果枚举数成功地推进到下一个元素,则为 true;如果枚举数越过集合的结尾,则为 false。void Reset()将枚举数设置为其初始位置,该位置位于集合中第一个元using System;using System.Collections;namespace Console 阅读全文
posted @ 2011-10-19 07:50 JaysD 阅读(233) 评论(0) 推荐(0) 编辑
摘要: View Code 1 using System; 2 using System.Collections; 3 4 public class Person 5 { 6 public Person(string fName, string lName) 7 { 8 this.firstName = fName; 9 this.lastName = lName; 10 } 11 12 public string firstName; 13 public string lastName; 14 } 15 ... 阅读全文
posted @ 2011-10-19 07:47 JaysD 阅读(153) 评论(0) 推荐(0) 编辑
摘要: View Code 1 //用来记录开始和结束的时间 2 DateTime startTime = new DateTime(); 3 DateTime endTime = new DateTime(); 4 5 //定义集合类型ArrayList的一个实例 6 ArrayList list = new ArrayList(); 7 8 //取得当前时间 9 startTime = DateTime.Now;10 11 //★★★★★★★★①使用ArrayList类★★★★★★★★12 //ArrayList的add方法的参数是Object型,13 //当我们把int型作为参数传入的时候... 阅读全文
posted @ 2011-10-19 07:18 JaysD 阅读(94) 评论(0) 推荐(0) 编辑