Book of Red Gate 2010 - Red Gate Software
Book of Red Gate 2010 - Red Gate Software
Book of Red Gate 2010 - Red Gate Software
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
4. Fill in the … to make this valid<br />
… x = Part1();<br />
Part2(x);<br />
5. I wrote this bit <strong>of</strong> code but before I got to run it, my<br />
friend refactored it. Was my version better?<br />
My version<br />
var results = new List();<br />
for (int i = 0; i < 5; i++)<br />
{<br />
}<br />
var j = 2*i;<br />
results.Add(() => j);<br />
results.ForEach(x => Console.<br />
WriteLine(x()));<br />
His version<br />
var results = new List();<br />
for (int i = 0; i < 5; i++)<br />
{<br />
results.Add(() => 2 * i);<br />
}<br />
results.ForEach(x => Console.<br />
WriteLine(x()));<br />
103