列表<T> .IsReadOnly在哪里?

Phi*_*hil 2 .net interface list

在.Net Framework中,List<T>实现ICollection<T>接口.但是,在Visual Studio中查看List类时,我看不到IsReadOnly属性,这可能是在ICollection<T>接口中.

一个类如何实现一个接口......但是没有真正实现它?

Jon*_*eet 5

它使用显式接口实现.例如:

public interface IFoo 
{
    void Bar();
}

public Foo : IFoo
{
    // Note the lack of public here
    void IFoo.Bar() {}
}
Run Code Online (Sandbox Code Playgroud)