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.
- Position the caret at the name of a symbol that you want to delete.
- Choose ReSharper | Refactor | Safe Delete, or press Alt+Delete. The Safe Delete
dialog box opens:
- Click Next. If no usages of the symbol are found, the symbol is
deleted immediately. If ReSharper finds usages, it shows the Conflicts page:
- Look through the list and try to
- Click Next to delete the symbol.
Using the Safe Delete refactoring you can safely remove not only symbols, but also assembly references.
- Select assembly references you want to remove in the Solution Explorer window.
- 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.
- 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.
- Click Next to apply the refactoring.