using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; public class Test { public static void Main() { var str = "abcdefghijklmnopqrstuvwxyz"; var r = new Random(); var sourceList = Enumerable.Range(0,1000000).Select(n=>str[r.Next(str.Length)].ToString()).ToArray(); var sw = new Stopwatch(); sw.Start(); var outList = new List(); for(int i = 0; i < sourceList.Length; i++){ if(sourceList[i] == "a" || sourceList[i] == "b"){ outList.Add(sourceList[i]); } } sw.Stop(); Console.WriteLine("for : " + sw.Elapsed); sw.Reset(); sw.Start(); var outList2 = sourceList.Where(s=>s=="a" || s=="b").ToList(); sw.Stop(); Console.WriteLine("linq: " + sw.Elapsed); } }