Ócáid
Mar 17, 9 PM - Mar 21, 10 AM
Bí ar an tsraith meetup chun réitigh AI inscálaithe a thógáil bunaithe ar chásanna úsáide fíor-dhomhanda le forbróirí agus saineolaithe eile.
Cláraigh anoisNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
Property | Value |
---|---|
Rule ID | IDE0075 |
Title | Simplify conditional expression |
Category | Style |
Subcategory | Language rules (expression-level preferences) |
Applicable languages | C# and Visual Basic |
Options | dotnet_style_prefer_simplified_boolean_expressions |
This style rule concerns simplifying conditional expressions that return a constant value of true
or false
versus retaining conditional expressions with explicit true
or false
return values.
Options specify the behavior that you want the rule to enforce. For information about configuring options, see Option format.
Property | Value | Description |
---|---|---|
Option name | dotnet_style_prefer_simplified_boolean_expressions | |
Option values | true |
Prefer simplified conditional expressions |
false |
Do not prefer simplified conditional expressions | |
Default option value | true |
// dotnet_style_prefer_simplified_boolean_expressions = true
var result1 = M1() && M2();
var result2 = M1() || M2();
// dotnet_style_prefer_simplified_boolean_expressions = false
var result1 = M1() && M2() ? true : false;
var result2 = M1() ? true : M2();
' dotnet_style_prefer_simplified_boolean_expressions = true
Dim result1 = M1() AndAlso M2()
Dim result2 = M1() OrElse M2()
' dotnet_style_prefer_simplified_boolean_expressions = false
Dim result1 = If (M1() AndAlso M2(), True, False)
Dim result2 = If (M1(), True, M2())
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 IDE0075
// The code that's violating the rule is on this line.
#pragma warning restore IDE0075
To disable the rule for a file, folder, or project, set its severity to none
in the configuration file.
[*.{cs,vb}]
dotnet_diagnostic.IDE0075.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.
Aiseolas .NET
Is tionscadal foinse oscailte é .NET. Roghnaigh nasc chun aiseolas a thabhairt:
Ócáid
Mar 17, 9 PM - Mar 21, 10 AM
Bí ar an tsraith meetup chun réitigh AI inscálaithe a thógáil bunaithe ar chásanna úsáide fíor-dhomhanda le forbróirí agus saineolaithe eile.
Cláraigh anois