是否可以仅实现接口的特定属性/方法

时间:2018-04-16 06:30:35

标签: c# interface

我正在查看实现以下接口System.Array的{​​{1}}类的类定义。我意识到这个类没有实现所有属性/方法定义它正在实现的接口。 例如。 IList接口有以下声明:

ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable

但是public interface IList : ICollection, IEnumerable { object this[int index] { get; set; } bool IsFixedSize { get; } bool IsReadOnly { get; } int Add(object value); void Clear(); bool Contains(object value); int IndexOf(object value); void Insert(int index, object value); void Remove(object value); void RemoveAt(int index); } 类仅实现System.Array接口的以下属性:

IList

请帮帮我。

0 个答案:

没有答案