private void MainForm_Load(object sender, EventArgs e)
{
Func<int, bool> f = funn;
var list = new List<int>();
list.Add(32);
list.Add(1);
list.Add(2);
list.Add(3);
MessageBox.Show(list.Where(f).First().ToString());//I give only f
}
private bool funn(int k)
{
return k == 12;
}
请参阅Where
子句参数
private void MainForm_Load(object sender, EventArgs e)
{
Func<int, bool> f = funn;
var list = new List<int>();
list.Add(32);
list.Add(1);
list.Add(2);
list.Add(3);
MessageBox.Show(list.Where(i=>f(i)).First().ToString());//Now I give f with i
}
private bool funn(int k)
{
return k == 12;
}
那么,那些调用过滤器方法的国王有什么区别呢?