Anonymous Functions (Lamda)
Also known as "lambda functions". These are functions created on the flight for usually a one-time use. They are defined with the => operator:
s => Console.WriteLine(s);
This is the same as creating a named function like this:
void outputFunc(s)
{
Console.WriteLine(s);
}
Create a "on the flight" method. For example a method like this:
// type functionname input { return output }
int ScoreByKillCount(PlayerStats stats) {
return stats.kills;
}
can be shortened in a nameless function
// input => output
stats => stats.kills
which can be given for example as a delegate.