Tuesday, September 26, 2006

Predicate Pleasure

I've been playing around with predicates in my latest developments but had been using private members to store my find criteria as demonstrated in the dinosaur example on MSDN2. However, I now realise that my preferred way to use predicates is using anonymous methods as below.

private Customer FindCustomerByName(string name)
return Customers.Find(delegate(Customer customer) { return customer.name.Equals(name); });

I think this is a much neater way of going about things.

Bye for now !

No comments: