Local Functions and Lambdas
Functions can live inside methods. Lambdas use =>.
Example
int Add(int a, int b) => a + b;
Func<int, int> dbl = x => x * 2;
Action<string> say = s => Console.WriteLine(s);
say($"{Add(1, 2)} {dbl(4)}");Exercise
Lambda arrow.
x x * 2
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.