Test Code/C#
[Lambda] FindAll
yaks101
2015. 3. 4. 17:58
/*
조건에 해당되는 값을 모두 찾아서 List로 리턴해 줍니다.
*/
using System; using System.Collections.Generic; class Test_Lambda { static void Main() { List<int> list = new List<int> () { 50, 10, 12, 25, 18, 5 ,30, 32, 35, 40 }; Console.WriteLine("짝수이고 30이하인 값 찾기"); List<int> findList = list.FindAll(x => x % 2 == 0 && x < 30); foreach(int i in findList) { Console.WriteLine(i); } } }