This project is read-only.
1
Vote

AV1739 Underscore for unused lambda parameters

description

That doesn't quite scale. See, in the example code you need one underscore for the first parameter and already two of them for the second (because they must be unique and there is only one underscore).

Instead, I now take lambda expressions as the one and only place where I allow single-letter variable names. (Aside of maybe very short loops. Really short.) It doesn't hurt to have unused single-letter parameters here. The example code would look like this:

button.Click += (s, e) => HandleClick();

s and e are for the common sender and e. Which is wrong again because e is actually not allowed here. I mostly rename the generated 'e' parameter to args. So the two parameters should actually be called s and a. But then again, it's not very important because they're unused anyway...

comments

dennisdoomen wrote Jun 25, 2015 at 7:35 PM

We've moved. Please post any issues at https://github.com/dennisdoomen/csharpguidelines