public static void Main()
int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var evenNumbersShorterLambda = numbers.Where(numFromNumbers => numFromNumbers % 2 == 0);
var evenNumbers = numbers.Where(
return numFromNumbers % 2 == 0;
Action<string> writeHelloFriend =
Console.WriteLine($"Hello {friend}");
writeHelloFriend("Dave");
Action<string> writeHelloFriend2 =
Console.WriteLine($"Hello {friend}");
writeHelloFriend2("Dave");
Console.WriteLine(sayHello());
Console.WriteLine(sayHello2());
Func<string, string> helloFriend =
Console.WriteLine(helloFriend("Dave"));
Func<int, int, string> add =
$"Result of x + y ({x} + {y}) is {x + y}";
Console.WriteLine(add(2, 3));
Func<int, int, string> multiply =
$"My multiply Func does this: x * y ({x} * {y}) is {x * y}";
string result1 = PerformCalculation(multiply, 4, 5);
Console.WriteLine(result1);
$"Result of a * b ({a} * {b}) is {a * b}",
Console.WriteLine(result2);
$"Not going to calculate anything",
Console.WriteLine(result3);
$"Discarding the parameters",
default(int), default(int));
Console.WriteLine(result4);
string PerformCalculation(Func<int, int, string> calculation, int a, int b)
return $"The lambda is called in PerformCalculation. {calculation(a, b)}";