Dr.*_*len 0 c# abstract-class interface
我有一个实现3个接口的抽象类.
public abstract class ServiceBaseCore<Entity, EntityKey> : MarshalByRefObject, IComponentService, IEntityProvider<Entity, EntityKey>
where Entity : IEntityId<EntityKey>, new()
where EntityKey : IEntityKey, new()
{
// Provided functionality/body to some methods of interface
}
Run Code Online (Sandbox Code Playgroud)
问题:我得到的错误是我的抽象类没有为接口函数提供实现(定义/正文),其中我读到的是"如果一个类是抽象的,那么就不需要为所有/任何函数提供主体界面实施".
注意:代码是由codeSmith生成的,即使它显示错误.
请告诉我我错在哪里以及我错过了什么.
谢谢
只需创建一些抽象函数,编译器就会停止抱怨:
public abstract void MyMethodDeclaredInTheInterface();
Run Code Online (Sandbox Code Playgroud)
编辑:要加快进程,只需将插入符号移动到抽象类中的接口名称,然后按ctrl +.并选择"实现接口YourInterface".然后稍微搜索并替换NotImplementedException就可以了.