- #ifdef、 #define、 #else、 #endif
- 从零开始学习jQuery (十一) 实战表单验证与自动完成提示插件
- 提升营销效果应首先走出网站标题写作误区
- 给力2012的地方门户的草根站长
- 面向搜索引擎的网站设计
- CentOS命令启动及CentOS命令启动网卡
- Vue 3 响应式对象:ref 和 reactive 的使用和区别
- 做外贸用什么软件和客户交流
- 关键字排名下降处理方法
- Sitemap_网站地图
邮箱:
手机:15383239821
IList和IList
IList<T>是按照位置对集合进行索引的标准接口。除了从ICollection<T>和IEnumerable<T>继承的功能之外,它还可以按位置(通过索引器)读写元素,并在特定位置插入/删除元素。
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
{
T this[int index] { get; set; }
int IndexOf(T item);
void Insert(int index, T item);
void RemoveAt(int index);
}
IndexOf方法可以对列表执行线性搜索,如果未找到指定的元素则返回-1。
IList的非泛型版本具有更多的成员,因为(相比泛型版本)它从ICollection继承过来的成员比较少:
public interface IList : ICollection, IEnumerable
{
object this[int index] { get; set; }
bool IsReadOnly { get; }
bool IsFixedSize { get; }
int Add(object value);
void Clear();
bool Contains(object value);
int IndexOf(object value);
void Insert(int index, object value);
void Remove(object value);
void RemoveAt(int index);
}
非泛型的IList接口的Add方法会返回一个整数代表最新添加元素的索引。相反,ICollection<T>的Add方法的返回类型为void。
通用的List<T>类实现了IList<T>和IList两种接口。C#的数组同样实现了泛型和非泛型版本的IList接口。
-
2012-06-29如何删除VS2008/VS2005/VS2003中最近的项目
-
2013-06-23NVARCHAR 和VARCHAR区别和使用 .
-
2013-02-16解析DIV+CSS在IE6和IE7中的区别
-
2012-07-02网站关键词确定后如何围绕进行优化
-
2013-10-30asp.net文件与文件夹操作类(文件删除,创建,目录删除)
