Anonymous methods and collections in Whidbey


There are some nice new methods on the collection classes in Whidbey that I think will make your life easier.

 

From Krzysztof‘s blog.

 

Comments (2)

  1. One more reason to dislike anonymous methods. Huge potential for abuse by Copy/Paste-style programmers.

    The body of the method belog is just a one-liner. Imagine if it was multiliner. Total disaster….

    List<Order> orders1 = new List<Order>();

    List<Order> orders2 = new List<Order>();

    List<Order> orders3 = new List<Order>();

    order = orders1.Find(delegate(Order o){

    return o.Number==orderNumber;

    });

    order = orders2.Find(delegate(Order o){

    return o.Number==orderNumber;

    });

    order = orders3.Find(delegate(Order o){

    return o.Number==orderNumber;

    });