简体   繁体   English

如何制作类接口要求实现IEnumerable

[英]How to make a class interface Require an implementation of IEnumerable

I simply need to know the "requires" syntax for a C# class interface. 我只需要知道C#类接口的“ requires”语法。 If I have a class like this: 如果我有这样的课程:

public interface IGroupNode : ISceneNode

How can I make the interface require the implementation of IEnumerable? 如何使接口要求实现IEnumerable? I think this is very simple and just a syntax thing, but feel free to prove me wrong. 我认为这很简单,只是语法问题,但可以随时证明我错了。

Update: 更新:

public interface IGroupNode : ISceneNode, IEnumerable<ISceneNode>

Now I'm confused on where to implement IEnumerable? 现在,我对在哪里实现IEnumerable感到困惑? I have no concrete class implementation of ISceneNode. 我没有ISceneNode的具体类实现。 Should I do it in the concrete class implementation of IGroupNode instead? 我应该在IGroupNode的具体类实现中执行此操作吗?

public interface IGroupNode : ISceneNode, IEnumerable

就像您使用其他界面一样。

public interface IGroupNode : ISceneNode, IEnumerable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM