동적 메서드 호출을 사용하여 동적으로로드 된 dll의 메서드에 액세스하고 있습니다.동적 메서드 호출이 매개 변수와 함께 실패합니다.
내가 뭐하는 거지 :
dynamic classInstance = Activator.CreateInstance(cmd.Type);
classInstance.AddString(); //This line works
classInstance.AddString(cmd); //this line does not work
을 DLL의 방법은 다음과 같습니다
public CustomCommandTest1()
{
}
public void AddString(Command cmd, ExposedVariables exv)
{
exv.ChopResults += "Add string Command";
}
public void AddString(ExposedVariables exv)
{
exv.ChopResults += "Add string Command";
}
public void AddString()
{
string ChopResults = "Add string Command";
}
내가 액세스 할 수 있습니다
(호출) 매개 변수를하지만 나에게를 제공 할 것과이없는 모든 방법 RuntimeBindingInternalCompilerException입니다. 예외를 알아낼 수있는 유용한 정보는 없습니다.
이전에 해본 적이 있는데 효과가있었습니다. 내가 여기서 무엇을하고 있는지 알지 못한다.
추가 발견은 복잡한 변수 유형과 관련이 있음을 나타냅니다. 간단한 내장 변수 유형이 작동합니다. 그러나 공통 파일의 정의를 참조 할 때 복잡한 변수의 정의에는 차이가 없습니다. 그냥 cmd를 걸리는 과부하를하지 않는 것으로
'cmd'는 무엇입니까? – SLaks
동적 호출로 전달하는 유형이 잘못되었습니다. SLaks와 마찬가지로 'cmd'의 유형은 무엇입니까? – asawyer