1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Customer
{
    public int ID { get; set; }
    public static bool Test(Customer x)
    {
        return x.ID == 5;
    }
}
...
List<Customer> custs = new List<Customer>();
custs.Add(new Customer() { ID = 1 });
custs.Add(new Customer() { ID = 5 });
  
custs.First(new Func<Customer, bool>(delegate(Customer x) { return x.ID == 5; }));
custs.First(new Func<Customer, bool>((Customer x) => x.ID == 5));
custs.First(delegate(Customer x) { return x.ID == 5; });
custs.First((Customer x) => x.ID == 5);
custs.First(x => x.ID == 5);
custs.First(Customer.Test);
 
具体查看http://www.cnblogs.com/niyw/archive/2010/10/07/1845232.html
posted on 2016-08-15 15:31  褚海达  阅读(196)  评论(0编辑  收藏  举报