我想使用lambda表达式做一些事情并且它不使用任何参数,我知道我可以使用表单() => foo()但是我无法弄清楚在作为参数传递lambda的函数原型中该做什么
这是代码
class c {
public static void Main() {
Bar(() => Console.WriteLine("Hey"));
}
public static void Bar(what_goes_here foo) {
foo(); //Should print "Hey"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
128 次 |
| 最近记录: |