c# 4.0 - How is the long method way of doing below code in "Lambda Expressions" in the past? -


public static ienumerable<t> get<t>(this ienumerable<t> source, func<t, bool> predicate)     {         foreach (t item in source)         {             if (predicate(item))                 yield return item;         }     } 

like this:

public static ienumerable<t> get<t>     (ienumerable<t> source, func<t, bool> predicate) {     var list = new list<t>();      foreach (t item in source)     {         if (predicate(item))         {             list.add(item);         }     }      return list; } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -