linq function All, Any, Aggregate described

int [] arrInt; 
            arrInt = new new  int [] { . 1 , 2 , . 3 , 45 , . 6 , . 8 , . 9 }; 

            var R1 = arrInt.All (m => m> 10 ); // all elements meet the conditions, to false 
            var R2 = arrInt.Any (m => m> 10 ); // if any one of the elements satisfy the condition, to true 

            int [] = {numbers1 . 1 , 2 , . 3 , . 4 , . 5 , . 6 , . 7 , . 8, . 9 };
             var Query1 numbers1.Aggregate = ((A, B) => A * B); // aggregate function returns the result as an argument, is equal to ((((((((1 * 2) * 3) * . 4). 5 *). 6 *) *. 7). 8 *) *. 9) 

            var List Enumerable.Range = ( . 1 , 100 );
             var Result list.Aggregate = ((A, B) => (A + B)); // returns 1 + ... + 100 and 

            var the nums = Enumerable.Range ( 2 , . 4 );
             var SUM = nums.Aggregate ( 1 , (a, B) => a * B); // 2 => 5 factorial

 

Guess you like

Origin www.cnblogs.com/binlyzhuo/p/11344159.html