Hoons에서 먼가를 찾다가 발견한 강좌인데 까먹기 전에 포스팅(이라 적고 메모라읽는다)을 하나~
우선 자세한 내용은 이 강좌를 확인 하시고 여기서는 사용 하는 방법만 메모를 -_-b
좋은 강좌를 써주신 김수영님 캄솨 합니닷~
우선 자세한 내용은 이 강좌를 확인 하시고 여기서는 사용 하는 방법만 메모를 -_-b
좋은 강좌를 써주신 김수영님 캄솨 합니닷~
public MainPage()
{
InitializeComponent();
int[] source = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
List<int> oddNumbers = FilterOfInts(source, i => ((i & 1) == 1));
List<int> evenNumbers = FilterOfInts(source, i => ((i & 1) == 0));
listbox1.ItemsSource = oddNumbers;
listbox2.ItemsSource = evenNumbers;
}
private static List<int> FilterOfInts(int[] source, Func<int, bool> filter)
{
List<int> result = new List<int>();
foreach (int i in source)
{
if (filter(i) == true)
{
result.Add(i);
}
}
return result;
}