To extract a method
  1. In the editor, select a block of code to be converted into a method.
  2. On the ReSharper menu or context menu, choose Refactor | Extract Method. The Extract Method dialog box opens:
    Extract Method refactoring
    Image 1:
  3. In the Name text box, type the method name.
  4. If you want to create a static method, select Declare static.
  5. From the Return value list, select one of expressions that ReSharper detected as possible method return values (if any). To create a void method, select No return value.
      Expressions detected as possible return values will have the out modifier in the parameters list.
  6. In the Parameters area, you can do the following:
    • Change the names of the detected method parameters.
    • Reorder the parameters using the Move Up and Move Down buttons.
    • Include or exclude parameters by selecting or clearing the corresponding check boxes. If you exclude a parameter from the list, the local variable with the same name and type will be created in the method. The variable will be initialized by the "..." value that you need to correct manually.
  7. In the Visibility area, specify the visibility of the new method.
  8. Check the results in the Signature preview text box, and click Continue.