共 2 篇文章 |
|
一个类型要想支持foreach则必须实现IEnumerable,IEnumerator两个接口。Collections, Library: BCL public interface IEnumerable...{ IEnumerator GetEnumerator();Collections, Library: BCL public interface IEnumerator...{ bool MoveNext();public class cars : IEnumerator,IEnumerable.//IEnumerator and IEnumerable require ... 阅556 转4 评0 公众公开 15-11-30 09:12 |
这段代码演示了System.Collections.Generic的各容器类的用法,包括:Dictionary,KeyValuePair,SortedDictionary,SortedList,HashSet,SortedSet,List,Queue,Stack等类的用法。Dictionary<string, int> dict = new Dictionary<string, int>();SortedDictionary<string, int> dict = new SortedDictionary<string, i... 阅242 转0 评0 公众公开 15-11-30 09:09 |