To introduce a parameter to a method or constructor
  1. In the code editor, select an expression inside a method or constructor:
    Image 1:
  2. Choose ReSharper | Refactor | Introduce Parameter, or press Ctrl+Alt+P.
    • If the selected expression occurs two or more times in the current method or constructor, ReSharper asks to specify how many occurrences it should replace:
      Image 2:
    • If the selected expression occurs only once, the Introduce Parameter wizard opens immediately:
      Image 3:
  3. Specify the following options:
    • In the Parameter name text box, choose a suggested name for the new parameter, or enter a custom name.
    • If the selected expression requires passing the parameter as a lambda expression, select members to en-lambda in the Select local variables to en-lambda section.
  4. Click Next. If ReSharper discovers no conflicts, the refactoring is applied immediately. The following figure shows how ReSharper generates a delegate parameter:
    Image 4:
    This is how a method call transforms to pass a lambda expression:
    Image 5: