Answers for "c# arrow functions"

C#
0

c# arrow

// Make a new lambda function
Func<string, string> greet = (name) => $"Hello, {name}!";

// Call it
Console.WriteLine(greet("John"));
Posted by: Guest on September-05-2020
0

arrow functon c#

string[] words = { "bot", "apple", "apricot" };
int minimalLength = words
  .Where(w => w.StartsWith("a"))
  .Min(w => w.Length);
Console.WriteLine(minimalLength);   // output: 5

int[] numbers = { 4, 7, 10 };
int product = numbers.Aggregate(1, (interim, next) => interim * next);
Console.WriteLine(product);   // output: 280
Posted by: Guest on November-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language