C# Lambda with no inputs (params)?

c#, lambda

Solution

You almost did from the top of your head :). Check MSDN for more details, but this is what you are looking for:

public void test()
{
    exc(()=>1);
}

Problem

I was just wondering about this case ``` void exc(Func<int> fn) { fn(); } ``` I can do the below ``` public void test() { exc(delegate{return 1;}); } ``` However I like the => syntax so i tried ``` public void test() { exc(void=>1); } ``` It didnt compile. Is there a way I may use the => syntax?

Original source