All rules
IDE0018Language rules (expression-level preferences)

Inline variable declaration

Inline variable declaration

Microsoft docs

Description

This style rule concerns whether out variables are declared inline or not. Starting in C# 7, you can declare an out variable in the argument list of a method call, rather than in a separate variable declaration.

Example

// csharp_style_inlined_variable_declaration = true
if (int.TryParse(value, out int i)) {...}

// csharp_style_inlined_variable_declaration = false
int i;
if (int.TryParse(value, out i)) {...}

Configurable options

Vote for the value each option should take in the generated .editorconfig.

csharp_style_inlined_variable_declaration
default: true
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0