.NET code-style analysis provides rules that aim to maintain consistent style in your codebase. These rules have an "IDE" prefix in the rule ID.
The code-style rules are organized into the following subcategories:
Language and unnecessary code rules
Rules that pertain to the C# or Visual Basic language. For example, you can specify rules that regard the use of var
when defining variables, or whether expression-bodied members are preferred. This category also includes rules that find unnecessary code, for example, unreachable code within methods or unused private fields, properties, or methods.
Rules that pertain to the layout and structure of your code in order to make it easier to read. For example, you can specify a formatting option that defines whether spaces in control blocks are preferred or not.
Rules that pertain to the naming of code elements. For example, you can specify that async
method names must have an "Async" suffix.
Rules that do not belong in other categories.
The following table list all the code-style rules by ID and options, if any.
Note
There are some rules that only surface in the Visual Studio IDE, and these regard JSON and regular expression pattern strings. For more information, see JSON001, JSON002, and RE0001.
LegendThe following table shows the type of information that's provided for each rule in the reference documentation.
Item Description Rule ID The unique identifier for the rule. Used for configuring rule severity and suppressing warnings in the code file. Title The title for the rule. Category The category for the rule. Subcategory The subcategory for the rule, such as Language rules, Formatting rules, or Naming rules. Applicable languages Applicable .NET languages (C# or Visual Basic), along with the minimum language version, if applicable. Introduced version Version of the .NET SDK or Visual Studio when the rule was first introduced. Options Any available options for the rule. See alsoRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4