ReSharper Web Help

When a field has a single write usage, this dialogless refactoring:

  • Creates new local variables holding initialization expression of the field to substitute its read usages.
  • Deletes the field declaration and the write usage.
To inline a field
  1. Position the caret at a field that has exactly one write usage.


    If the selected field has more than one write usage, ReSharper reports a conflict.
  2. Choose ReSharper | Refactor | Inline, or press Ctrl+Alt+N. If no conflicts are discovered, ReSharper inlines the field immediately.

For example, the following field is initialized when it's declared and it doesn't have any other write usages:
Here's a read usage of the field before applying the refactoring:
After inlining the field, ReSharper creates local variables to hold initialization expression of the refactored field, and substitutes read usages of the field with read usages of the variables:

See Also