Lambda Expressions, Func, and Action
Prerequisites: Delegates & events
Func<...> and Action<...> are built-in generic delegate types,
so a custom delegate declaration is rarely needed in practice:
Func<int, int, int> add = (a, b) => a + b; // takes 2 ints, returns an int
Console.WriteLine(add(2, 3)); // 5
Action<string> greet = name => Console.WriteLine($"Hi, {name}");
greet("Ada"); // Hi, Ada
Func<...>'s last type parameter is always the return type;
Action<...> is for a delegate that returns nothing.