C# Lambda Operator (=>)

PHOTO EMBED

Tue Jun 28 2022 15:37:52 GMT+0000 (Coordinated Universal Time)

Saved by @Marcos_ #c#

//Lambda with parameters
int[] numbers = { 4, 7, 10 };
int product = numbers.Aggregate(1, (int interim, int next) => interim * next);
Console.WriteLine(product);   // output: 280

//Without parameters
Func<string> greet = () => "Hello, World!";
Console.WriteLine(greet());
content_copyCOPY

Input parameters of a lambda expression are strongly typed at compile time. When the compiler can infer the types of input parameters, like in the preceding example, you may omit type declarations. If you need to specify the type of input parameters, you must do that for each parameter, as the following example shows:

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-operator