lambda functions vs anonymous methods vs code reading

by Marius Gheorghe 3. September 2007 19:23
Remember that code is written to be read and sometimes compiled and run ? Here are some code snippets comparing lambda function with anonymous methods from a code reading perspective : Anon method :

ds.ForEach(delegate(Developer d)
{
d.b = 3;
});

Lamda:
ds.ForEach(d = > d.b = 5);

While you have to love how small the code is, from the reading perspective this is pretty bad. It will be better if we add the args types :

ds.ForEach( (Developer d) = > d.b = 5);


Tags:

dotNET