不应该算是私有的,应该叫做显示实现接口
因为二者都有 Count ,为了区别它的实现方式就变成这样了string[] ar = new string[5];
IList il = ar as IList;
il.Add();

解决方案 »

  1.   

    显式实现的接口成员,只有将变量转换成接口类型,才可以访问,抄楼上:string[] arr = new string[5];
    arr.Count.ToString();    //  不能编译IList list = arr as IList;
    list.Count.Tostring();  //  恭喜你能编译了
      

  2.   

    因为二者都有 Count ,为了区别它的实现方式就变成这样了,我觉得这句是关键。
    这算不算接口多态?
      

  3.   

    array就是数组的意思,是new不出来的,是抽象类啊
    public abstract class Array
      

  4.   


    我看了,就ICollection接口声明了Count属性.IList接口中声明了Add(..)方法。Aarry虚拟类、IList接口和ICollection接口没有再声明其他Add(..)和Count了。请指教!
      

  5.   

    奇怪了 为什么我的能编译?
                string[] arr = new string[5];
                Console.Write(arr.Count());
    编译没有任何问题..
                string[] arr = new string[5];
                Console.WriteLine( arr.Count());
                IList list = arr as IList;
                Console.WriteLine(list.Count);
    编译也没任何问题只是arr.Count()是一个方法 不是属性.. 我用的VS2008
      

  6.   


    第一个程序不可能编译通过的。Array中根本就没Count()方法。
      

  7.   

    在VS2008里面 确实有这么一个count()方法 string[] arr = new string[5];  
    Console.Write(arr.Count());  
    这个在VS2008里面编译是没有任何问题的 
     这个COUNT()方法是个扩展方法(.NET3.5新特性)
      

  8.   

    string[] arr = new string[5];  数据一般用Length集合一般用Count
      

  9.   

    2楼的理论根据在
    ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.chs/dv_fxdesignguide/html/e3766a81-fbe6-4358-8e9e-9424a892dd79.htm
    注意其中一段文字如下:
    当接口成员由类显式实现时,只能通过使用对接口的引用来访问该成员。这将导致隐藏接口成员。
      

  10.   

    就只能这么硬性理解了。谁让C#是Microsoft搞的呢,它怎么我们就怎么做吧。Thanks