It is to indicate that the anonymous function it represents has no parameter. It was the way you arranged for the syntax not to be lame, since you always have to have something before the =>
which separates the parameters from the body of the function.
There’s nothing different from the others Amble.
In theory they could leave without, but it gets weird and could create some ambiguity in the future, if it is that already does not have and I did not realize. Design language requires good taste and thinking about the future.
Think of the common function, normally it would have parentheses always, having a parameter or not. Why a lambda don’t need to? Well, because it is a convenience syntax, the less write better (and it is not because of typing, it is to give more legibility even, and go straight to the point). So she avoids parentheses whenever possible, this is not a possible case.
Another case where they are needed is when you have more than one parameter. So convenience is only for one parameter, which is the most commonly used case.
I didn’t need the keys.
MyDelegate d = () => Console.WriteLine("Ola mundo lambda! :]");
I put in the Github for future reference.
Look how weird, but you could have accepted it like this:
MyDelegate d = => Console.WriteLine("Ola mundo lambda! :]");
Imagine the person forgetting the space between the two =
.
From what I understand from explanation by @utluiz, means there’s no parameter being passed.
– user28595