C # getting started with Lambda,
1 using System; 2 using System. collections. generic; 3 using System. linq; 4 using System. text; 5 6 namespace LambdaSample 7 {8 class Program 9 {10 static void Main (string [] args) 11 {12 int [] myIntArray = {1, 2, 3, 4, 5}; 13 // The accumulators calculate the total number of arrays. 14 int result = myIntArray. aggregate (paramA, paramB) => paramA + paramB); 15 int result1 = myIntArray. aggregate <int> (paramA, paramB) => paramA + paramB); 16 int result2 = myIntArray. aggregate <int, int> (0, (paramA, paramB) => paramA + paramB); 17 // recursively calculates the total number of arrays 18 int result3 = count (5); 19 Console. writeLine ("The Result is:" + result); 20 Console. writeLine ("The Result1 is:" + result1); 21 Console. writeLine ("The Result2 is:" + result2); 22 Console. writeLine ("The Result3 is:" + result3); 23 24 string [] myStrArray = {"Admin", "Change", "ByPage "}; 25 // string Array splicing question 26 string strResult = myStrArray. aggregate (paramA, paramB) => paramA + "" + paramB); 27 // The total length of the string array is calculated as 28 int result4 = myStrArray. aggregate <string, int> (0, (a, B) => a + B. length); 29 // string Array splicing 2, adding the string "Some curries:" 30 string strResult1 = myStrArray. aggregate <string, string> ("Some curries:", (a, B) => a + "" + B); 31 // calculate the total length of the string array 2 hovertree. com32 int result5 = myStrArray. aggregate <string, string, int> ("Some curries:", (a, B) => a + "" + B, a =>. length); 33 Console. writeLine ("The StrResult is:" + strResult); 34 Console. writeLine ("The Result4 is:" + result4); 35 Console. writeLine (strResult1); 36 Console. writeLine ("The Result5 is:" + result5); 37 Console. readKey (); 38} 39 40 static int count (int n) 41 {42 if (n = 1) 43 {44 return 1; 45} 46 return n + count (n-1); 47} 48} 49}