开发者

How to call invoke when use Func<string, bool>

In the function Test(Func<string,bool> f), how to call f.invoke(开发者_如何学编程)? I received the error Delegate 'Func' does not take '0' arguments


bool b = f(someString);

or:

bool b = f.Invoke(someString);


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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜