In the function Test(Func<string,bool> f)
, how to call f.invoke()? I received the error
Delegate 'Func' does not take '0' arguments
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The delegate Func<string, bool>
is a delegate that takes a string as an argument and returns bool. To invoke it, you need to supply a string.
e.g., either should work
f("foo");
f.Invoke("foo");
回答2:
bool b = f(someString);
or:
bool b = f.Invoke(someString);