LINQ Aggregator Operators (집계연산자)
시퀀스의 값에 대해 계산을 수행하는 방법 Count // 중복되는 값을 제거하고 counting int[] factorsOf300 = { 2, 2, 3, 5, 5 }; int uniqueFactors = factorsOf300.Distinct().Count(); Console.WriteLine($"There are {uniqueFactors} unique factors of 300."); // output There are 3 unique factors of 300. // 2로 나눈 나머지가 1인것 찾기 (홀수) int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int oddNumbers = numbers.Count(n => n % 2 == 1); Console.W..
2022.02.09