This documentation is archived and is not being maintained.

Review unused parameters







Breaking Change


A method signature includes a parameter that is not used in the method body. The following methods are not examined by this rule:

  • Methods referenced by a delegate.

  • Methods used as event handlers.

  • Methods declared with the abstract (MustOverride in Visual Basic) modifier.

  • Methods declared with the virtual (Overridable in Visual Basic) modifier.

  • Methods declared with the override (Overrides in Visual Basic) modifier.

  • Methods declared with the extern (Declare statement in Visual Basic) modifier.

Review parameters in non-virtual methods that are not used in the method body to insure no correctness exists around failure to access them. Unused parameters incur maintenance and performance costs. Sometimes a violation of this rule can point to an implementation bug in the method (i.e. the parameter should actually have been used in the method body). Exclude warnings of this rule if the parameter has to exist because of backward compatibility.

To fix a violation of this rule, remove the unused parameter (a breaking change) or use the parameter in the method body (a non-breaking change). If the this parameter is reported, change the method declaration to include the static (Shared in Visual Basic) modifier (a breaking change).

It is safe to exclude a warning from this rule for previously shipped code for which the fix would be a breaking change.

The following shows two methods, one that violates the rule and one that satisfies the rule.