ReSharper Web Help

The Inline Method refactoring replaces the usages of a method with its body and optionally removes the original method declaration. Static, instance and extension methods are all supported.


This refactoring also works with properties.

The reverse functionality is provided by the Extract Method refactoring.

To inline a method
  1. Place the caret at a method declaration or method call to inline, or select a method declaration in the File Structure window.
  2. Do one of the following:
    • On the main menu, choose ReSharper| Refactor | Inline.
    • Choose Refactor | Inline on the context menu.
    • Press Ctrl+Shift+R, then click Inline Method.
    • Press Ctrl+Alt+N.
  3. The Inline Method dialog box opens.

  4. Select the Inline all usages check box to inline all usages of the method. Otherwise, ReSharper replaces only the usage where the caret is.
  5. Select the Remove inlined method declaration check box to remove the original method declaration. Otherwise, ReSharper leaves it as is.
  6. Click Next. If no conflicts are found, ReSharper performs the refactoring immediately. Otherwise, resolve conflicts.


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

Consider the example below:

After applying the refactoring, the ProcessAssemblyMetadata method call is replaced with its body.

See Also


External Links