ReSharper Web Help

If you are going to delete a type, type member, or any other symbol in C# or VB.NET code files, ASP.NET code and markup, build scripts, or XAML, use the Safe Delete refactoring to ensure that the delete operation is safe. If there are no symbol usages found, the symbol will be deleted right away. Otherwise, ReSharper will show all the usages, allowing you to edit the corresponding code. Usages that can be safely deleted are marked with the icon. Removing usages marked with the icon, will lead to compilation errors.

To safely delete a symbol
  1. Position the caret at the name of a symbol that you want to delete.
  2. Choose ReSharper | Refactor | Safe Delete, or press Alt+Delete. The Safe Delete dialog box opens:
  3. Click Next. If no usages of the symbol are found, the symbol is deleted immediately. If ReSharper finds usages, it shows the Conflicts page:
  4. Look through the list and try to resolve conflicts .
  5. Click Next to delete the symbol.

Using the Safe Delete refactoring you can safely remove not only symbols, but also assembly references.

To safely remove assembly references
  1. Select assembly references you want to remove in the Solution Explorer window.
  2. Do one of the following:
    • On the main menu, choose ReSharper | Refactor | Safe Delete.
    • Press Ctrl+Shift+R, then click Safe Delete Assembly Reference.
    • Press Alt+Delete.
  3. If only unused references are selected, then the refactoring is performed immediately without displaying the dialog. Otherwise, the Safe Delete Assembly Reference dialog is displayed.
  4. Click Next to apply the refactoring.

 Note

When you perform an undo action, pay attention that all changes in source code will be reverted, but assembly references will not be added back.

See Also

Procedures