IList的< INT> VS名单< INT> [英] IList<int> vs List<int>
本文介绍了IList的< INT> VS名单< INT>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你能帮助我理解的实际之间的差异这两个;
的IList< INT> myList中=新名单< INT>();
名单,LT; INT> myList中=新名单< INT>();
解决方案
的IList< INT> myList中=新名单< INT>();
只会暴露的接口公开的方法的IList
列表< INT> myList中=新名单< INT>();
将暴露在列表
对象的所有成员
我不打算列出这里所有的差异,但你可以检查出MSDN上的成员列表中为每个完整的列表:
Can you help me understand the practical differences between these two;
IList<int> myList = new List<int>();
List<int> myList = new List<int>();
解决方案
IList<int> myList = new List<int>();
will only expose the methods exposed by the interface IList
List<int> myList = new List<int>();
will expose all members of the List
object
I'm not going to list all the differences here, but you can check out the member lists on MSDN for a complete list for each:
IList(T) Members
List(T) Members
这篇关于IList的< INT> VS名单< INT>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文