Edit

Share via


IntelliSense completion for unimported types and extension methods

This refactoring applies to:

  • C#

  • Visual Basic

What: IntelliSense gives completion for unimported types and extension methods.

When: You want to use a type or extension method with a dependency in your project, but the using directive isn't added to your file.

Why: You don't have to manually add the using directive to your file.

How-to

  1. After you start to enter the name of a type or extension method with a dependency in your project, IntelliSense shows you suggestions. In the list, items from unimported namespaces are shown with their containing namespace as a suffix.

    Tip

    You can show/hide items from unimported namespaces on demand by selecting Expander next to the completion list. (Or use the Alt+A keyboard shortcut.)

    To change the default behavior, open the Tools > Options pane and expand the All Settings > Languages > C# (or Visual Basic) > IntelliSense section. Select or clear the Show items from unimported namespaces checkbox.

    Tip

    You can show/hide items from unimported namespaces on demand by selecting Expander next to the completion list. (Or use the Alt+A keyboard shortcut.)

    To change the default behavior, open the Tools > Options dialog and expand the Text Editor > C# (or Visual Basic) > IntelliSense section. Select or clear the Show items from unimported namespaces checkbox, and then select OK.

  2. Select a suggestion and commit an unimported item.

    The using directive is automatically added to your file.

    IntelliSense completion for unimported types

See also