Resharper tells me to
Actually, it doesn't. There are (broadly) two categories of things R# communicates to the user: things it thinks the user should do, and things that the user might want to do, that it can facilitate being done more quickly.
An example of the first:
var i = 4;
i = 5;
DoSomething(i);
The assignment of 4
will produce the "Assignment is not used" inspection, with a light bulb icon in the left margin, offering a quick-fix action to fix it (by removing the assignment).
An example of the second:
if ((new Random()).Next() > 5)
{
DoSomething();
}
else
{
DoSomethingElse();
}
Positioning the cursor on the if
will produce a pencil icon in the left margin, offering a context action to invert the if
. It's not saying you should - it's saying, "hey, if you want to do this, just select this menu item and I'll do it for you".
Adding an argument name is in the second category, a context action. If you don't want to be offered it, you can turn it off in ReSharper | Options | Code Editing | C# | Context Actions
. For Code Inspections, the popup menu itself offers the opportunity to change the inspection severity; or you can look at all of them in ReSharper | Options | Code Isnpection | Inspection Severity
.
Personally there are some context actions I don't think I've ever used (eg "convert to hex"), but there are others that I find invaluable for speedy coding (various combinations of switching between ?:
and if
and inverting, for example)