常用接口简析3---IList和List的解析
常用接口的解析(链接)
1.IEnumerable深入解析
2.IEnumerable、IEnumerator接口解析
3.IComparable、IComparable接口解析
学习第一步,先上菜:
#region 程序集 mscorlib.dll, v4.0.30319
// C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll
#endregion using System;
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices; namespace System.Collections.Generic
{
// 摘要:
// 表示可按照索引单独访问的一组对象。
//
// 类型参数:
// T:
// 列表中元素的类型。
[TypeDependency("System.SZArrayHelper")]
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
{
// 摘要:
// 获取或设置指定索引处的元素。
//
// 参数:
// index:
// 要获得或设置的元素从零开始的索引。
//
// 返回结果:
// 指定索引处的元素。
//
// 异常:
// System.ArgumentOutOfRangeException:
// index 不是 System.Collections.Generic.IList<T> 中的有效索引。
//
// System.NotSupportedException:
// 设置该属性,而且 System.Collections.Generic.IList<T> 为只读。
T this[int index] { get; set; } // 摘要:
// 确定 System.Collections.Generic.IList<T> 中特定项的索引。
//
// 参数:
// item:
// 要在 System.Collections.Generic.IList<T> 中定位的对象。
//
// 返回结果:
// 如果在列表中找到,则为 item 的索引;否则为 -1。
int IndexOf(T item);
//
// 摘要:
// 将一个项插入指定索引处的 System.Collections.Generic.IList<T>。
//
// 参数:
// index:
// 从零开始的索引,应在该位置插入 item。
//
// item:
// 要插入到 System.Collections.Generic.IList<T> 中的对象。
//
// 异常:
// System.ArgumentOutOfRangeException:
// index 不是 System.Collections.Generic.IList<T> 中的有效索引。
//
// System.NotSupportedException:
// System.Collections.Generic.IList<T> 为只读。
void Insert(int index, T item);
//
// 摘要:
// 移除指定索引处的 System.Collections.Generic.IList<T> 项。
//
// 参数:
// index:
// 从零开始的索引(属于要移除的项)。
//
// 异常:
// System.ArgumentOutOfRangeException:
// index 不是 System.Collections.Generic.IList<T> 中的有效索引。
//
// System.NotSupportedException:
// System.Collections.Generic.IList<T> 为只读。
void RemoveAt(int index);
}
}
List的内容太多了
public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
从上面内容就可以看到,List继承了三个泛型接口,还继承了三个常规的接口。
说白了,就是List是类,继承IList<T>泛型版本和IList非泛型版本接口。List是一个集合类。
IList<T>是接口,说明这个对象要去实现接口里定义的方法。
IList<T> 服务泛型集合(List<T>),IList服务非泛型集合(Array)
以上只是个人学习的理解,后续会进行跟进,大家有什么想法可以畅所欲言。
常用接口简析3---IList和List的解析的更多相关文章
- 常用接口简析1---IEnumerable、IEnumerator简析
常用接口的解析(链接) 1.IEnumerable深入解析 2.IComparable.IComparable接口解析 3.IList.IList接口解析 引言: IEnumerable和I ...
- 常用接口简析2---IComparable和IComparer接口的简析
常用接口的解析(链接) 1.IEnumerable深入解析 2.IEnumerable.IEnumerator接口解析 3.IList.IList接口解析 默认情况下,对象的Equals(object ...
- Spring常用注解简析
1. Autowired 自动装配,其作用是为了消除代码Java代码里面的getter/setter与bean属性中的property.当然,getter看个人需求,如果私有属性需要对外提供的话,应当 ...
- Linux之常用命令简析
ls cd mkdir rmdir touch ln cp rm mv 1.ls 显示当前目录下的文件及文件夹(不显示隐藏的) -l 显示详细信息 --all 显示隐藏的文件及文件夹(就是显 ...
- Java Android 注解(Annotation) 及几个常用开源项目注解原理简析
不少开源库(ButterKnife.Retrofit.ActiveAndroid等等)都用到了注解的方式来简化代码提高开发效率. 本文简单介绍下 Annotation 示例.概念及作用.分类.自定义. ...
- Java Annotation 及几个常用开源项目注解原理简析
PDF 版: Java Annotation.pdf, PPT 版:Java Annotation.pptx, Keynote 版:Java Annotation.key 一.Annotation 示 ...
- Android 11(R) Power HAL AIDL简析 -- 基本接口
Android 11(R) Power HAL AIDL将分三篇文章来介绍: Android 11(R) Power HAL AIDL简析 -- 基本接口 Android 11(R) Power HA ...
- SpringMVC源码情操陶冶-DispatcherServlet简析(二)
承接前文SpringMVC源码情操陶冶-DispatcherServlet类简析(一),主要讲述初始化的操作,本文将简单介绍springmvc如何处理请求 DispatcherServlet#doDi ...
- SpringMVC源码情操陶冶-HandlerAdapter适配器简析
springmvc中对业务的具体处理是通过HandlerAdapter适配器操作的 HandlerAdapter接口方法 列表如下 /** * Given a handler instance, re ...
随机推荐
- Opencv基础课必须掌握:滑动条做调色盘 -OpenCV步步精深
滑动条做调色盘 我们来想一下这个程序需要什么,首先需要一个窗口显示一切=.=(︿( ̄︶ ̄)︿废话一样): 说到调色盘除了画板也就是窗口(默认为黑色),调色就要涉及三种颜色 红色Red(我们用R表示), ...
- ASP.NET Web API 2中的错误处理
前几天在webapi项目中遇到一个问题:Controller构造函数中抛出异常时全局过滤器捕获不到,于是网搜一把写下这篇博客作为总结. HttpResponseException 通常在WebAPI的 ...
- hover与click样式冲突
如果你的hover事件和click事件的样式不同,如元素背景本来是#fff,如果hover时背景是#ddd,点击时背景是#aaa,那么问题是当你点击后,鼠标再移动到这个元素时背景会变成#ddd,而你希 ...
- Java8之旅(六) -- 使用lambda实现尾递归
前言 本篇介绍的不是什么新知识,而是对前面讲解的一些知识的综合运用.众所周知,递归是解决复杂问题的一个很有效的方式,也是函数式语言的核心,在一些函数式语言中,是没有迭代与while这种概念的,因为此类 ...
- Mybatis基本用法--上
Mybatis基本用法--上 本文只是为自己查漏补缺.全面的请看官方文档,支持中英文 原理参考:http://blog.csdn.net/luanlouis/article/details/40422 ...
- 微信退款流程,以及在过程中遇见的错误和解决方式(php 语言)
官方下载demo 1:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=11_1 开发步骤 : https://pay.weix ...
- LeetCode 54. Spiral Matrix(螺旋矩阵)
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral or ...
- EJBCA安装教程+postgresql+wildfly10
1. 安装环境说明 笔者在本机的虚拟机下进行的安装,数据库已经装好了的. ubuntu16.04 x64 postgresql:9 wildfly10 2. 安装前准备 下载必要软件包(直接到官网下载 ...
- trait与policy模板技术
trait与policy模板技术 我们知道,类有属性(即数据)和操作两个方面.同样模板也有自己的属性(特别是模板参数类型的一些具体特征,即trait)和算法策略(policy,即模板内部的操作逻辑). ...
- 暑假练习赛 004 E Joint Stacks(优先队列模拟)
Joint StacksCrawling in process... Crawling failed Time Limit:4000MS Memory Limit:65536KB 64 ...