C# Action delegates with Lamda expressions
19 November, 2008 § Leave a comment
The other day I was writing a program from a top-down approach. I don’t usually write code like this, unless I’m doing some test driven development. TDD is interesting because it puts the design over the implementation. By top-down I mean that I first wrote the Main method, then worked on fleshing out all the classes that I had envisioned from there. One of my main goals was for very readable code without comments.
My main method looked like this:
public static void Main() { var carLot = new CarLot( "cars.xml" ); carLot.Each( car => car.StartEngine(); car.UnlockDriverSideDoor(); ); }