我对C#中接口的继承语法有点不清楚。在C中声明接口继承#
例如:
public interface IFoo
{
}
public interface IBar : IFoo
{
}
是什么这之间的区别:
public interface IQux : IBar
{
}
这:
public interface IQux : IBar, IFoo
{
}
或者,对于现实世界的例子,为什么ICollection<T>
宣布像这样:
public interface ICollection<T> : IEnumerable<T>, IEnumerable
,而不是这样的:
public interface ICollection<T> : IEnumerable<T>
因为IEnumerable<T>
已经从IEnumerable
继承?
它是一个很好的问题 –
没有必要明确列出基础接口已实施,但它很好的清晰。 IOW,没有功能差异。 – Blorgbeard
赞同@Blorgbeard,没有什么区别,只是为了清晰起见 –