All rules
IDE0016Language rules (expression-level preferences)
Use throw expression
Use throw expression
Microsoft docsDescription
This style rule concerns the use of throw expressions instead of throw statements. Set the severity of rule IDE0016 to define how the rule should be enforced, for example, as a warning or an error.
Example
// csharp_style_throw_expression = true
this.s = s ?? throw new ArgumentNullException(nameof(s));
// csharp_style_throw_expression = false
if (s == null) { throw new ArgumentNullException(nameof(s)); }
this.s = s;Configurable options
Vote for the value each option should take in the generated .editorconfig.
csharp_style_throw_expression default:
trueYour vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0