Thursday, 29 January 2009

The x => Factor

I may be swimming against the tide here, but I don't understand why it has become an idiom of C# to use x as the parameter name in lambda expressions, as in:
var matching = list.ForEach(x => x.Version > 1)
You wouldn't expect to see
foreach(var x in list)
if(x.Version > 1)
yield return x;
I suspect it has a lot to with conciseness. Whilst I highly value conciseness, I value readability over conciseness.

No comments: