(原创)(C#随笔)IEnumerable< ICollection < IList区别
2013-09-09 19:45
549 查看
public interface IEnumerable { IEnumerator GetEnumerator(); }
再看ICollection<T>
public interface ICollection<T> : IEnumerable<T>, IEnumerable { void Add(T item); void Clear(); bool Contains(T item); void CopyTo(T[] array, int arrayIndex); bool Remove(T item); int Count { get; } bool IsReadOnly { get; } }
再看IList<T>
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable { int IndexOf(T item); void Insert(int index, T item); void RemoveAt(int index); T this[int index] {get;set; } }
可见,IList要比ICollection要多索引器的功能,另外还可以用索引器来进行修改,标识IList是可读写的链表,而ICollection是只读的链表;
相关文章推荐
- [原创]琢磨一种察看/修改C#堆中东西的方法(随笔)
- [原创]琢磨一种察看/修改C#堆中东西的方法(随笔)
- [原创]琢磨一种察看/修改C#堆中东西的方法(随笔)
- C#精髓【月儿原创】第四讲 GridView 72般绝技
- [导入]C#利用钩子控制鼠标【月儿原创】
- C#使用正则表达式的类(原创)
- [原创]socket,c#,.net,dns,client,server,console
- 【原创】开源Math.NET基础数学类库使用(04)C#解析Matrix Marke数据格式
- 网络采集软件核心技术剖析系列(1)---如何使用C#语言获取博客园某个博主的全部随笔链接及标题
- [原创]C#启动VB进程外组件,规定其大小位置.并且给VB进程外组件的Text1.Text赋值
- 引用 【原创】故乡随笔之二
- C#中关键字ref与out的区别(原创)
- 【原创】C#实现列表绑定
- C#精髓【月儿原创】第四讲 GridView 72般绝技
- 【原创】C#与C++的混合编程--采用其中的第三种方法
- 【原创】C#调用存储过程
- [原创]There's nothing wrong with mono's C# compiler dealing with string encoding
- [原创][翻译整理]使用RAPI库操作移动设备——C#语言描述
- 一个简单的C#托盘程序(本站原创)
- 【原创】C# 递归获取指定目录的子目录及其所有文件