|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Remove Parameters is a refactoring operation that provides an easy way to remove parameters from methods, indexers, or delegates. Remove Parameters changes the declaration; at any locations where the member is called, the parameter is removed to reflect the new declaration.
You perform the Remove Parameters operation by first positioning the cursor on a method, indexer, or delegate. When the cursor is in position, you can invoke the Remove Parameters operation by selecting it from the Refactor menu, typing the keyboard shortcut, or by selecting the command from a context menu.
When you invoke the Remove Parameters command, the Remove Parameters dialog box appears. For more information, seeor .
You can remove parameters from a method declaration or a method call. Position the cursor in the method declaration or delegate name and invoke Remove Parameters.
Remove Parameters allows you to remove a parameter that is referenced within the body of the member, but it does not remove the references to that parameter in the method body. This can introduce build errors into your code. However, you can use theto review your code, before executing the refactoring operation.
If a parameter being removed is modified during the call to a method, the removal of the parameter will also remove the modification. For example, if a method call is changed from:
by the refactoring operation, param1 will not be incremented.