Generics, Predicates and Anonymous methods
Ah, got to love .NET Framework 2.0 - it is full of some really useful features. Here is some code that demonstrates three new concepts; Generics, Predicates and Anonymous methods. Its beauty is in it simplicity:public class SalesOrderItemCollection : List
{
public SalesOrderItem FindByItemId(int itemId)
{
return this.Find(delegate(SalesOrderItem i)
{
return i.ItemId == itemId;
});
}
}
0 Comments:
Post a Comment
<< Home