![](/img/trans.png)
[英]Can an attribute require inheritance or implementation of a class or interface?
[英]How to make a class interface Require an implementation of IEnumerable
我只需要知道C#类接口的“ requires”语法。 如果我有这样的课程:
public interface IGroupNode : ISceneNode
如何使接口要求实现IEnumerable? 我认为这很简单,只是语法问题,但可以随时证明我错了。
更新:
public interface IGroupNode : ISceneNode, IEnumerable<ISceneNode>
现在,我对在哪里实现IEnumerable感到困惑? 我没有ISceneNode的具体类实现。 我应该在IGroupNode的具体类实现中执行此操作吗?
public interface IGroupNode : ISceneNode, IEnumerable
就像您使用其他界面一样。
public interface IGroupNode : ISceneNode, IEnumerable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.