συμβάν
17 Μαρ, 9 μ.μ. - 21 Μαρ, 10 π.μ.
Συμμετάσχετε στη σειρά meetup για να δημιουργήσετε κλιμακούμενες λύσεις AI που βασίζονται σε πραγματικές περιπτώσεις χρήσης με συναδέλφους προγραμματιστές και ειδικούς.
Εγγραφή τώραΑυτό το πρόγραμμα περιήγησης δεν υποστηρίζεται πλέον.
Κάντε αναβάθμιση σε Microsoft Edge για να επωφεληθείτε από τις τελευταίες δυνατότητες, τις ενημερώσεις ασφαλείας και την τεχνική υποστήριξη.
This article describes two related rules, IDE0054
and IDE0074
.
Property | Value |
---|---|
Rule ID | IDE0054 |
Title | Use compound assignment |
Category | Style |
Subcategory | Language rules (expression-level preferences) |
Applicable languages | C# and Visual Basic |
Options | dotnet_style_prefer_compound_assignment |
Property | Value |
---|---|
Rule ID | IDE0074 |
Title | Use coalesce compound assignment |
Category | Style |
Subcategory | Language rules (expression-level preferences) |
Applicable languages | C# and Visual Basic |
Options | dotnet_style_prefer_compound_assignment |
These rules concern the use of compound assignment. IDE0074
is reported for coalesce compound assignments and IDE0054
is reported for other compound assignments.
The option value specifies whether or not compound assignments are desired.
For information about configuring options, see Option format.
Property | Value | Description |
---|---|---|
Option name | dotnet_style_prefer_compound_assignment | |
Option values | true |
Prefer compound assignment expressions |
false |
Don't prefer compound assignment expressions | |
Default option value | true |
// dotnet_style_prefer_compound_assignment = true
x += 5;
// dotnet_style_prefer_compound_assignment = false
x = x + 5;
' dotnet_style_prefer_compound_assignment = true
x += 5
' dotnet_style_prefer_compound_assignment = false
x = x + 5
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 IDE0054 // Or IDE0074
// The code that's violating the rule is on this line.
#pragma warning restore IDE0054 // Or IDE0074
To disable the rule for a file, folder, or project, set its severity to none
in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.IDE0054.severity = none
dotnet_diagnostic.IDE0074.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 σχόλια
.NET είναι ένα έργο ανοιχτού κώδικα. Επιλέξτε μια σύνδεση για να παρέχετε σχόλια:
συμβάν
17 Μαρ, 9 μ.μ. - 21 Μαρ, 10 π.μ.
Συμμετάσχετε στη σειρά meetup για να δημιουργήσετε κλιμακούμενες λύσεις AI που βασίζονται σε πραγματικές περιπτώσεις χρήσης με συναδέλφους προγραμματιστές και ειδικούς.
Εγγραφή τώρα