如何调用调用使用时函数功能:其中,字符串,布尔> [英] How to call invoke when use Func<string, bool>

查看:83
本文介绍了如何调用调用使用时函数功能:其中,字符串,布尔>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在功能测试(Func键<字符串,布尔&F)的温度,如何调用f.invoke()?我收到的错误 委托功能'时不带'0'参数

In the function Test(Func<string,bool> f), how to call f.invoke()? I received the error Delegate 'Func' does not take '0' arguments

推荐答案

委托 Func键&LT;字符串,布尔&GT; 是一个委托,它接受一个字符串作为参数,并返回布尔。要调用它,你需要提供一个字符串。

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.

如,无论是应工作

f("foo");
f.Invoke("foo");

这篇关于如何调用调用使用时函数功能:其中,字符串,布尔&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆