ReSharper Web Help

The Inline Method refactoring transfers a method's body into the body of some or all of its callers and optionally removes the original method altogether. Static, instance and extension methods are all supported.

The reverse functionality is provided by the Extract Method refactoring.

 Tip

This refactoring also works with properties.
To inline a method
  1. Position the caret at a method declaration or method call to inline, or select a method declaration in File Structure:
  2. Choose ReSharper | Refactor | Inline, or press Ctrl+Alt+N. The Inline Method dialog box will display:
  3. Specify refactoring options:
    • Inline all usages: if selected, inlines all usages of a method. If deselected, inlines only the method call that you positioned the caret at in the text editor. Becomes inactive in selected mode if the refactoring is executed upon a method declaration.
    • Remove inlined method declaration: if selected, removes the original method; otherwise, leaves it as is, without any usages.
  4. Click Next. If no conflicts are found, the refactoring will be successfully completed:

    Otherwise, resolve conflicts.

 Note

ReSharper will display a warning if you attempt to inline a method that has no usages, such as a Main() method.

See Also

Procedures

External Links