Remove Type Qualifier
- 2 minutes to read
Purpose
Converts the full-form type reference into the short form. This Refactoring removes the redundant type qualifier from types referenced using its full form (e.g., System.Text.StringBuilder) and adds the corresponding namespace reference if it does not already exist. This makes your code more concise, although it can decrease readability in special cases.
Availability
Available when the cursor is on a type referenced using its full form.
Usage
Place the caret on a full-form type reference.
NOTE
The blinking cursor shows the caret's position at which the Refactoring is available.
- Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
- Select Remove Type Qualifier menu item.
After execution, the Refactoring removes the namespace from its reference and ensures it is referenced.
using System.Text;
namespace CRRDemo {
class Program {
static void Main(string[] args) {
var o = new StringBuilder();
}
}
}
NOTE
If you need to remove the type qualifier from all full-form type references in the current file, use the Remove Type Qualifier (remove all) Code Actions Menu item.