test
2015-08-05 16:19
253 查看
// 支持对非泛型集合的简单迭代 public interface IEnumerator { object Current { get; } // 获取集合中的当前元素 bool MoveNext(); // 将枚举数推进到集合的下一个元素 void Reset(); // 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前 }
// 公开枚举数,该枚举数支持在非泛型集合上进行简单迭代 public interface IEnumerable { IEnumerator GetEnumerator(); // 返回一个循环访问集合的枚举器。 }
// 定义所有非泛型集合的大小、枚举数和同步方法 public interface ICollection : IEnumerable { int Count { get; } // 取得当前集合元素个数 bool IsSynchronized { get; } // 判断当前集合是否可同步访问(线程安全) object SyncRoot { get; } // 取得当前集合可同步访问的对象 void CopyTo(Array array, int index); // 从当前集合索引index开始,复制元素到数组array中 }
// 列表接口:可按照索引单独访问的对象的非泛型集合。 public interface IList : ICollection, IEnumerable { object this[int index] { get; set; } // 获取或设置位于指定索引处的元素 bool IsFixedSize { get; } // 判断当前集合是否大小固定(不可扩展) bool IsReadOnly { get; } // 判断当前集合是否只读 bool Contains(object value); // 判断当前集合是否包含元素value int IndexOf(object value); // 取得元素value的索引值 int Add(object value); // 添加元素 void Insert(int index, object value); // 在索引指定位置插入元素value void Remove(object value); // 移除第一个匹配的元素value void RemoveAt(int index); // 移除索引指定的元素 void Clear(); // 清空列表 }
// 字典接口:键/值对的非通用集合。 public interface IDictionary : ICollection, IEnumerable { object this[object key] { get; set; } // 获取或设置位于指定索引处的元素 bool IsFixedSize { get; } // 判断当前集合是否大小固定(不可扩展) bool IsReadOnly { get; } // 判断当前集合是否只读 ICollection Keys { get; } // 根据key取得集合元素 ICollection Values { get; } // 根据value集合元素 IDictionaryEnumerator GetEnumerator(); // 取得当前集合迭代器 bool Contains(object key); // 判断当前集合是否存在含有key值的元素 void Add(object key, object value); // 添加元素 void Remove(object key); // 移除key指定的元素 void Clear(); // 清空字典 }
// 公开枚举数,该枚举数支持在指定类型的集合上进行简单迭代。 public interface IEnumerable<out T> : IEnumerable { IEnumerator<T> GetEnumerator(); // 返回一个循环访问集合的枚举器。 }
// 定义操作泛型集合的方法。 public interface ICollection<T> : IEnumerable<T>, IEnumerable { int Count { get; } // 取得当前集合元素个数 bool IsReadOnly { get; } // 判断当前集合是否只读 void CopyTo(T[] array, int arrayIndex); // 从当前集合索引index开始,复制元素到数组array中 bool Contains(T item); // 判断当前集合是否存在元素item void Add(T item); // 添加元素 bool Remove(T item); // 移除元素 void Clear(); // 清空集合 }
// 表示可按照索引单独访问的一组对象。 public interface IList<T> : ICollection<T> , IEnumerable<T> , IEnumerable { T this[int index] { get; set; } // 获取或设置位于指定索引处的元素 int IndexOf(T item); // 取得item元素的索引值 void Insert(int index, T item); // 在索引index指定的位置插入元素item void RemoveAt(int index); // 移除指定位置的元素 }
// 表示键/值对的泛型集合。 public interface IDictionary<TKey, TValue> : ICollection<KeyValuePair<TKey, TValue>> , IEnumerable<KeyValuePair<TKey, TValue>> , IEnumerable { TValue this[TKey key] { get; set; } // 获取或设置位于指定索引处的元素 ICollection<TKey> Keys { get; } // 取得键集 ICollection<TValue> Values { get; } // 取得值集 bool ContainsKey(TKey key); // 判断是否包含指定键的元素 void Add(TKey key, TValue value); // 添加键/值对元素 bool Remove(TKey key); // 移除key指定的元素 // 取得key关联的值 bool TryGetValue(TKey key, out TValue value); }
// 支持对非泛型集合的简单迭代 public interface IEnumerator { object Current { get; } bool MoveNext(); // 将枚举数推进到集合的下一个元素 void Reset(); // 将枚举数设置为其初始位置,该位置位于集合中第一个元素之前 }
// 支持在泛型集合上进行简单迭代。。 public interface IEnumerator<out T> : IDisposable, IEnumerator { T Current { get; } // 获取集合中的当前元素 }
相关文章推荐
- C++中malloc/free与new/delete的区别及内存分配失败错误处理
- RTEMS-BBB(七):LED点亮
- 获取硬件信息
- 第14章 集合类
- JS绘制生成花瓣效果的方法
- C# ref和out参数的使用
- Mavan配置
- 微信公众平台开发整理
- jRTPlib支持多网卡,支持TCP
- 多线程之售票安全版
- telnet退出命令
- IOS XMPP的实践
- Problem C: P1053
- 设计模式 适配器模式
- HANA激活对象报错
- Creating ADF BC View Object Instances On The Fly!!!!!!
- omci批量升级
- php mysql 事务 锁 小计
- code first使用t4模板
- Android 自定义侧滑面板