2017-08-04 30 views
0

我想創建一個保存方法MAILMESSAGE,它拋出下面的錯誤:「System.Reflection.TargetParameterCountException」,而MAILMESSAGE調用方法mailwriter

An unhandled exception of type 'System.Reflection.TargetParameterCountException' occurred in mscorlib.dll Additional information: Parameter count mismatch.

下面是覆蓋方法:

_sendMethod.Invoke(
    Message, 
    BindingFlags.Instance | BindingFlags.NonPublic, 
    null, 
    new object[] { _mailWriter, true }, 
    null); 

回答

0

擴展方法不支持.NET framework 4.5以上版本。 因此會出現參數計數異常..在.NET Framework 4.0中,相同的擴展方法工作正常。