All rules
IDE0042Language rules (expression-level preferences)
Deconstruct variable declaration
Deconstruct variable declaration
Microsoft docsDescription
This style rule concerns the use of deconstruction in variable declarations, when possible.
Example
// csharp_style_deconstructed_variable_declaration = true
var (name, age) = GetPersonTuple();
Console.WriteLine($"{name} {age}");
(int x, int y) = GetPointTuple();
Console.WriteLine($"{x} {y}");
// csharp_style_deconstructed_variable_declaration = false
var person = GetPersonTuple();
Console.WriteLine($"{person.name} {person.age}");
(int x, int y) point = GetPointTuple();
Console.WriteLine($"{point.x} {point.y}");Configurable options
Vote for the value each option should take in the generated .editorconfig.
csharp_style_deconstructed_variable_declaration default:
trueYour vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0