作成した明示的なインターフェイスに問題があり、例外が発生しています。
'x' には 'y' の定義が含まれておらず、タイプ 'x' の最初の引数を受け入れる拡張メソッド 'y' が見つかりませんでした
私は一連のクラスを持っています。基本クラス:
public interface IFactoryResponse
{
object instance { get; set; }
string instanceconfig { get; set; }
}
それを明示的に実装するクラス:
public class FactoryResponseImpl : IFactoryResponse
{
object IFactoryResponse.instance {
get { return ((IFactoryResponse)this).instance; }
set { ((IFactoryResponse)this).instance = value; }
}
string IFactoryResponse.instanceconfig {
get { return ((IFactoryResponse)this).instanceconfig; }
set { ((IFactoryResponse)this).instanceconfig = value; }
}
}
別のクラスでは、上記のエラーが発生します。Visual Studio はインターフェイスとクラスを正常に検出できますが、インスタンス プロパティを解決できません。ここで何が欠けていますか。明示的な継承のより洗練されたルールの 1 つが欠けている可能性があります。
if (facconfig.useabstract) {
response.instance = Activator.CreateInstance(m_entassembly.GetType(entconfig.Classname, true, true));
response.instanceconfig = facconfig.config;
} else {
Assembly assem = Assembly.LoadFrom(facconfig.assemblyfile);
object Obj = Activator.CreateInstance(assem.GetType(facconfig.Classname, true, true));
response.instance = Obj;
response.instanceconfig = facconfig.config;
}