If you are exposing your class through a library that others will use, you generally want to expose it via interfaces rather than concrete implementations. This will help if you decide to change the implementation of your class later to use a different concrete class. In that case the users of your library won't need to update their code since the interface doesn't change.

If you are just using it internally, you may not care so much, and using List<T> may be ok.

List<T> or IList<T>的更多相关文章

  1. DataTable转换成IList<T>的简单实现

    DataTable的无奈 很多时候,我们需要去操作DataTable.但DataTable的操作,实在是太不方便了.Linq?lambda表达式?统统没有... 特别是对现有结果集做进一步筛选,这样的 ...

  2. Entity Framework中使用IEnumerable<T>、IQueryable<T>及IList<T>的区别

    1. IEnumerable<T> IEnumerable<T> :对于在内存中集合上运行的方法,返回的可枚举对象将捕获传递到方法的参数.在枚举该对象时,将使用查询运算符的逻辑 ...

  3. C#中IList与List

    C#中IList<T>与List<T>的区别感想 写代码时对: IList IList11 =new List (); List List11 =new List (); 有所 ...

  4. NetworkComms V3 使用TCP通信传递IList<T>类型的数据

    客户端从服务器获取一组IList<T>类型的数据非常常见(通常从数据库中获取) 我们用NeworkComms V3来演示一下(NetworkcommsV2.x版本也同样支持) [ 使用pr ...

  5. 将IList转换为List

     简单点说,IList<T>直接转换为List<T>可以不用考虑.IList<T>可以用至少2种方式简单的复制成List<T>:1.IList<T ...

  6. NHibernate无法将类型“System.Collections.Generic.IList<T>”隐式转换为“System.Collections.Generic.IList<IT>

    API有一个需要实现的抽象方法: public IList<IPermission> GetPermissions(); 需要注意的是IList<IPermission>这个泛 ...

  7. 基础知识系列☞IList ←vs→ List

    原文地址→http://www.cnblogs.com/zbphot/archive/2011/11/04/2235933.html IList接口→表示可按照索引单独访问的对象的非泛型集合. ILi ...

  8. IEnumerable<> ICollection <> IList<> 区别

    IEnumerable< ICollection < IList区别 public interface IEnumerable { IEnumerator GetEnumerator(); ...

  9. 【转载】我也说 IEnumerable,ICollection,IList,List之间的区别

    做C#的同学们,都知道,一类只能有一个继承类,但可以实现多个接口.这句话就告诉我们:IEnumerable,ICollection,IList,List区别了 首先我看看 IEnumerable: / ...

  10. C#集合--ICollection接口和IList接口

    虽然列举接口提供了一个协议,用于向前的方式遍历集合,但它们没有提供一种机制来确定集合的大小,通过索引访问集合的成员,搜索集合,或修改集合.为了实现这些功能,.NET Framework定义了IColl ...

随机推荐

  1. scons 简单入门

    scons 简单入门 摘自:https://www.jianshu.com/p/e4bd3ab9e5d6 0.2042019.01.20 12:58:44字数 1201阅读 3021 简单入门 hel ...

  2. pcm、wav、amr说明

    wav比pcm多44个字节(在文件头位置多)

  3. LeetCode_326. Power of Three

    326. Power of Three Easy Given an integer, write a function to determine if it is a power of three. ...

  4. HDU1237 简单计算器 栈

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1237 题目大意:读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值. 题目分 ...

  5. C-LODOP回调多个返回值On_Return_Remain

    c-lodop默认一次只能回调一个值,回调后会销毁,如果想回调多个值,可加该语句:LODOP.On_Return_Remain=true;之前有博文:lodop和c-lodop通过打印状态和任务不在队 ...

  6. 原生JavaScript判断浏览器对CSS属性是否支持

    /*判断浏览器是否支持某个css属性*/ function SupportCss(attrName){ var i=0, arr = SupportCss.opt.aBrowser, eleStyle ...

  7. Juniper总结

    Juniper的路由器分为两个部分——RE和PFE.不过貌似大部分路由器都分为这两个部分.... Routing Engine: 当密码授权通过之后,用户就进入了RoutingEngine中,在其中可 ...

  8. 大师Geoff Hinton关于Deep Neural Networks的建议

    大师Geoff Hinton关于Deep Neural Networks的建议 Note: This covers suggestions from Geoff Hinton's talk given ...

  9. idea创建自定义代码块

    1.File——>settings 2.找到Editor——>live Templates,点击加号+ 3.创建group或直接创建,我这里创建了一个user组,然后在user组里面添加l ...

  10. python基础篇(二)

    PYTHON基础篇(二) if:else,缩进 A:if的基础格式和缩进 B:循环判断 C:range()函数和len()函数 D:break,contiue和pass语句 for,while循环 函 ...