4
linqは表面に表示されるよりも効率的ですか?
このようなものを書くと: var things = mythings .Where(x => x.IsSomeValue) .Where(y => y.IsSomeOtherValue) これは次と同じですか: var results1 = new List<Thing>(); foreach(var t in mythings) if(t.IsSomeValue) results1.Add(t); var results2 = new List<Thing>(); foreach(var t in results1) if(t.IsSomeOtherValue) results2.Add(t); または、以下のように機能するいくつかの魔法があります: var results = new List<Thing>(); foreach(var t in mythings) if(t.IsSomeValue && t.IsSomeOtherValue) results.Add(t); それともまったく異なるものですか?