public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerableList<T>继承了 ICollection 接口代码
List<int> list = new List<int>();怎么list点不出 "IsSynchronized"属性了,“IsSynchronized”跑那去了?
List<int> list = new List<int>();怎么list点不出 "IsSynchronized"属性了,“IsSynchronized”跑那去了?
List <int> list = new List <int>();
bool b = ((System.Collections.ICollection)list).IsSynchronized;
Console.WriteLine(b);
为什么要这样呢?Class 继承了接口,就得实现接口的方法和属性啊。List<int> list = new List<int>();
实例化了 Class , 它就应该是 list的 属性啊
如:
public interface Test1
{
int Count { get;}
}public interface Test2 : Test1
{
bool IsTest { get;}
}public class Test : Test2
{
public bool IsTest
{
get { return false; }
}
public int Count
{
get {return 0; }
}}
Test t = new Test();
t.Count;
t.IsTest;
http://msdn.microsoft.com/zh-cn/library/ms229034(VS.80).aspx
我在“MSDN"文档中看到了,说它是“显示接口实现"但我在
public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
{}
没有看到?这是为什么呢?