如何解决“没有合适的方法来覆盖”错误? [英] How to resolve "no suitable method to override" error?
本文介绍了如何解决“没有合适的方法来覆盖”错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个功能:
protected override void DeserializeSection(XmlReader reader)
现在在论证中如果我正在放置
protected override void DeserializeSection(RegistrationInfoSetting _regInfo)。
但是在构建中它给出了一个错误没有合适的方法来覆盖。
可能是什么原因以及如何解决?
注意: XmlReader是一个摘要class
而RegistrationInfoSettingDB就像这样
公共类RegistrationInfoSettingsDB:BaseDB,IRegistrationInfoSettingDB
推荐答案
您收到错误,因为没有方法DeserializeSection
带有RegistrationInfoSetting
作为基类中的参数;只有一个XmlReader
作为参数。因此,您不能(也不需要)覆盖它,因为它不在基类中。您可以通过删除覆盖
字来解决此问题。
You get the error because there is no methodDeserializeSection
with aRegistrationInfoSetting
as parameter in the base class; there is only one with aXmlReader
as parameter. So, you cannot (and don't need to) override it, because it is not in the base class. You can resolve this by removing theoverride
word.
这篇关于如何解决“没有合适的方法来覆盖”错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文