草庐IT

DelegatedCall

全部标签

c# - 无法从 'method group' 转换为 'System.Action<object>' 错误

我创建了以下函数:publicvoidDelegatedCall(ActiondelegatedMethod)并定义了如下方法publicvoidfoo1(Stringstr){}但是,当我尝试调用DelegateCall时与foo1:DelegatedCall(foo1);...我收到以下编译器错误:Argument1:cannotconvertfrom'methodgroup'to'System.Action'此错误的原因是什么,我该如何更正它?不幸的是,类型转换foo1至Action不是一个选项。 最佳答案 Delegated

c# - 无法从 'method group' 转换为 'System.Action<object>' 错误

我创建了以下函数:publicvoidDelegatedCall(ActiondelegatedMethod)并定义了如下方法publicvoidfoo1(Stringstr){}但是,当我尝试调用DelegateCall时与foo1:DelegatedCall(foo1);...我收到以下编译器错误:Argument1:cannotconvertfrom'methodgroup'to'System.Action'此错误的原因是什么,我该如何更正它?不幸的是,类型转换foo1至Action不是一个选项。 最佳答案 Delegated