List<int> l = new List<int>() {1,2,3,4,5,6,7,8,9};
List<int> m = new List<int>();
foreach (int i in l) if (i >= 5) m.Add(i);
foreach (int i in m) Console.WriteLine(i);
When I could've done:
var l = new List<int>() {1,2,3,4,5,6,7,8,9};
l.FindAll(x => x >= 5).ForEach(Console.WriteLine);
Why didn't I figure this out a month ago.
No comments:
Post a Comment