[英]C# Complains that an Interface Method is not Implemented
namespace RepositoryFactory.Interface
{
public interface ISelectionFactory<TIdentityObject>
{
DbCommand ConstructSelectCommand(Database db, TIdentityObject idObject);
}
}
namespace SafetypadDAL
{
public class T_INCIDENT_SelectFactory:ISelectionFactory<T_INCIDENT>
{
public DbCommand ConstructSelectCommand(Database db, T_INCIDENT idObject)
{
//my business codes will be here
return command;
}
}
}
This is that program. 这是那个程序。
Here you can not find any wrong signature. 在这里您找不到任何错误的签名。
You may have implemented a method called ConstructSelectCommand
but with the wrong signature, so it wouldn't match the method. 您可能已经实现了一个名为
ConstructSelectCommand
的方法,但签名错误,因此与该方法不匹配。
If you're using VS2005 or later, click in the interface name in your class declaration, and press Ctrl and period (dot). 如果您使用的是VS2005或更高版本,请在类声明中单击接口名称,然后按Ctrl和句点(点)。 It will offer to generate the method stubs for you.
它会为您生成方法存根。
If you really, really think you've done the right thing, please post your declaration of that method. 如果您确实真的认为自己做对了,请发布该方法的声明。 Are you sure you've made it public, for instance?
例如,您确定已公开吗? (Or implemented the interface explicitly, of course.)
(当然,也可以显式实现该接口。)
EDIT: Is it possible that Database
in the two signatures refer to different types? 编辑:这两个签名中的
Database
是否可能引用不同的类型? What happens if you try what I suggested in terms of getting Visual Studio to generate the stub? 如果尝试使用我建议的使Visual Studio生成存根的方法,会发生什么?
You haven't implemented it. 您尚未实现。 Post the relevant part of the code, if you like.
如果愿意,请发布代码的相关部分。 Probably you can event instruct your IDE to attempt the implementation for you, just to get the exact signature.
可能您可以通过事件指示IDE尝试为您实施实现,只是获得确切的签名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.