首页 新闻 赞助 找找看

C#中为什么 List<T>类实现了IList接口又实现 ICollection接口啊?IList接口已经实现了 ICollcetion接口啊

0
[已解决问题] 解决于 2015-07-21 10:03

如题 ,我的理解是既然实现了IList接口,那么似乎实现ICollection接口是多余的了啊,因为IList接口已经继承自ICollection接口。

 

zhengldg的主页 zhengldg | 菜鸟二级 | 园豆:462
提问于:2015-06-29 13:26
< >
分享
最佳答案
0

.Explicit Interface Implementations


    
Show:                      
                           NameDescription
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library ICollection.CopyTo Copies the elements of the ICollection to an Array, starting at a particular Array index.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkSupported by Portable Class Library ICollection<T>.IsReadOnly Gets a value indicating whether the ICollection<T> is read-only.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkSupported by Portable Class Library ICollection.IsSynchronized Gets a value indicating whether access to the ICollection is synchronized (thread safe).
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkSupported by Portable Class Library ICollection.SyncRoot Gets an object that can be used to synchronize access to the ICollection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IEnumerable<T>.GetEnumerator Returns an enumerator that iterates through a collection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IEnumerable.GetEnumerator Returns an enumerator that iterates through a collection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IList.Add Adds an item to the IList.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IList.Contains Determines whether the IList contains a specific value.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IList.IndexOf Determines the index of a specific item in the IList.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IList.Insert Inserts an item to the IList at the specified index.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkSupported by Portable Class Library IList.IsFixedSize Gets a value indicating whether the IList has a fixed size.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkSupported by Portable Class Library IList.IsReadOnly Gets a value indicating whether the IList is read-only.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkSupported by Portable Class Library IList.Item Gets or sets the element at the specified index.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkSupported by Portable Class Library IList.Remove Removes the first occurrence of a specific object from the IList.
Top
奖励园豆:5
Launcher | 高人七级 |园豆:45045 | 2015-06-29 13:29
其他回答(2)
0

你没发现么?IList继承的只是ICollection 接口,而List<T> 实现的是ICollection<T>接口么?一个是泛型的,一个不是泛型的啊…… ICollection<T>是.Net2.0出现 泛型思想以后 添加的接口。原来的时候只有ICollection,所以List<T>为了 兼容以前的把ICollection<T>接口也实现啦啊

需要格局 | 园豆:2145 (老鸟四级) | 2015-06-29 17:07
0

你没发现么?IList继承的只是ICollection 接口,而List<T> 实现的是ICollection<T>接口么?一个是泛型的,一个不是泛型的啊…… ICollection<T>是.Net2.0出现 泛型思想以后 添加的接口。原来的时候只有ICollection,所以List<T>为了 兼容以前的把ICollection<T>接口也实现啦啊

Kero小柯 | 园豆:202 (菜鸟二级) | 2015-07-24 10:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册