.editorconfig and Code Cleanup question
I struggle to find information about the following:
1. Which Visual Studio Code Cleanup setting affects
IDE0059
? I can't find it in https://learn.microsoft.com/en-us/visualstudio/ide/code-styles-and-code-cleanup?view=vs-2022
2. Regarding IDE0059
is it possible to have the following config values prefer to not use any unused value assignment whatsoever?
These are my settings, which I applied after a code cleanup added unwanted _ =
in my code:
csharp_style_unused_value_assignment_preference = discard_variable:none
csharp_style_unused_value_expression_statement_preference = discard_variable:none
I.e. I want to prefer fun();
instead of _ = fun();
or int unused = fun();
.
The only options I see for these variables are discard_variable
and unused_local_variable
, and even if I find the answer to question 1, I doubt a new cleanup will remove the _ =
instead of ignoring them.
I assume "Find and Replace" is the best option in this particular case?
Here's the doc for IDE0059
for reference: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0059?pivots=lang-csharp-vbCode style options and code cleanup - Visual Studio (Windows)
Learn how to configure Visual Studio to apply code style preferences using the Code Cleanup (Visual Studio 2019) and Format Document (Visual Studio 2017) commands.
IDE0059 - .NET
Learn about code analysis style rule IDE0059.
0 Replies