Namespace declaration preferences (IDE0160 and IDE0161)
Artikkeli
This article describes two related rules, IDE0160 and IDE0161.
Property
Value
Rule ID
IDE0160
Title
Use block-scoped namespace
Category
Style
Subcategory
Language rules (code-block preferences)
Applicable languages
C#
Options
csharp_style_namespace_declarations
Property
Value
Rule ID
IDE0161
Title
Use file-scoped namespace
Category
Style
Subcategory
Language rules (code-block preferences)
Applicable languages
C#
Options
csharp_style_namespace_declarations
Overview
These rules apply to namespace declarations. For IDE0161 to report violations when block-scoped namespaces are used, you must set the associated option to file_scoped.
Options
The option value specifies whether namespace declarations should be block scoped or file scoped. By default, namespace declarations are block-scoped. This option is used by Visual Studio to determine how namespaces are declared when new code files are added to projects. Visual Studio honors the option value even if both IDE0160 and IDE0161 are disabled.
For information about configuring options, see Option format.
Liity tapaamissarjaan ja luo skaalattavia tekoälyratkaisuja, jotka perustuvat reaalimaailman käyttötapauksiin muiden kehittäjien ja asiantuntijoiden kanssa.