Atvik
Mar 17, 9 PM - Mar 21, 10 AM
Taktu þátt í fundarröðinni til að byggja upp skalanlegar gervigreindarlausnir byggðar á raunverulegum notkunartilvikum með öðrum forriturum og sérfræðingum.
Nýskrá núnaÞessi vafri er ekki lengur studdur.
Uppfærðu í Microsoft Edge til að nýta þér nýjustu eiginleika, öryggisuppfærslur og tæknilega aðstoð.
Property | Value |
---|---|
Rule ID | IDE0036 |
Title | Order modifiers |
Category | Style |
Subcategory | Language rules (modifier preferences) |
Applicable languages | C# and Visual Basic |
Introduced version | Visual Studio 2017 |
Options | csharp_preferred_modifier_order |
visual_basic_preferred_modifier_order |
This rule lets you enforce a desired modifier sort order.
The associated options for this rule let you specify the desired modifier order for C# and Visual Basic, respectively.
For information about configuring options, see Option format.
Property | Value | Description |
---|---|---|
Option name | csharp_preferred_modifier_order | |
Applicable languages | C# | |
Option values | One or more C# modifiers, such as public , private , and protected |
|
Default option value | public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, async |
// csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
class MyClass
{
private static readonly int _daysInYear = 365;
}
Property | Value | Description |
---|---|---|
Option name | visual_basic_preferred_modifier_order | |
Applicable languages | Visual Basic | |
Option values | One or more Visual Basic modifiers, such as Partial , Private , and Public |
|
Default option value | Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async |
' visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async
Public Class MyClass
Private Shared ReadOnly daysInYear As Int = 365
End Class
If you want to suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the rule.
#pragma warning disable IDE0036
// The code that's violating the rule is on this line.
#pragma warning restore IDE0036
To disable the rule for a file, folder, or project, set its severity to none
in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.IDE0036.severity = none
To disable all of the code-style rules, set the severity for the category Style
to none
in the configuration file.
[*.{cs,vb}]
dotnet_analyzer_diagnostic.category-Style.severity = none
For more information, see How to suppress code analysis warnings.
.NET umsögn
.NET er opið verkefni. Veldu tengil til að gefa umsögn:
Atvik
Mar 17, 9 PM - Mar 21, 10 AM
Taktu þátt í fundarröðinni til að byggja upp skalanlegar gervigreindarlausnir byggðar á raunverulegum notkunartilvikum með öðrum forriturum og sérfræðingum.
Nýskrá núna