接受空Lambda表达式的函数的定义原型

Ach*_*har 2 .net c#

我想使用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)

clc*_*cto 6

Action:

封装没有参数且不返回值的方法.