Del via


Options, Text Editor, C#, Advanced

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Use the Advanced options page to modify the settings for editor formatting, code refactoring, and XML documentation comments for C#. To access this options page, choose Tools > Options, and then choose Text Editor > C# > Advanced.

Note

Not all options may be listed here.

Analysis

Using Directives

  • Place 'System' directives first when sorting usings

    When selected, the Remove and Sort Usings command in the right-click menu sorts the using directives and places the 'System' namespaces at the top of the list.

    Before sorting:

    using AutoMapper;
    using FluentValidation;
    using System.Collections.Generic;
    using System.Linq;
    using Newtonsoft.Json;
    using System;
    

    After sorting:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using AutoMapper;
    using FluentValidation;
    using Newtonsoft.Json;
    
  • Separate using directive groups

    When selected, the Remove and Sort Usings command in the right-click menu separates using directives by inserting an empty line between groups of directives that have the same root namespace.

    Before sorting:

    using AutoMapper;
    using FluentValidation;
    using System.Collections.Generic;
    using System.Linq;
    using Newtonsoft.Json;
    using System;
    

    After sorting:

    using AutoMapper;
    
    using FluentValidation;
    
    using Newtonsoft.Json;
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    
  • Suggest usings for types in reference assemblies
  • Suggest usings for types in NuGet packages

    When these options are selected, a Quick Action is available to install a NuGet package and add a using directive for unreferenced types.

    Quick Action to install NuGet package in Visual Studio

  • Add missing using directives on paste

    When this option is selected, using directives will automatically get added to your code when you paste a type to a file.

Highlighting

  • Highlight references to symbol under cursor

    When the cursor is positioned inside a symbol, or when you click a symbol, all the instances of that symbol in the code file are highlighted.

Outlining

  • Enter outlining mode when files open

    When selected, automatically outlines the code file, which creates collapsible blocks of code. The first time a file is opened, #regions blocks and inactive code blocks collapse.

  • Show procedure line separators

    The text editor indicates visual scope of procedures. A line is drawn in the .cs source files of your project at locations listed in the following table:

    Location in .cs Source File Example of Line Location
    After the close of a block declaration construct - At the end of a class, structure, module, interface, or enum
    - After a property, function, or sub
    - Not between the get and set clauses in a property
    After a set of single line constructs - After the import statements, before a type definition in a class file
    - After variables declared in a class, before any procedures
    After single line declarations (non-block level declarations) - Following import statements, inherits statements, variable declarations, event declarations, delegate declarations, and DLL declare statements

Block Structure Guides

Select these check boxes to display dotted vertical lines between the curly brackets ({}) in your code. You can then easily see individual blocks of code for your declaration level and code level constructs.

Comments

  • Generate XML documentation comments for ///

    When selected, inserts the XML elements for XML documentation comments after you type the /// comment introduction. For more information about XML documentation, see XML Documentation Comments (C# Programming Guide).

See also