© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago
Rhythmic

.editorconfig and Code Cleanup question

I struggle to find information about the following:

1. Which Visual Studio Code Cleanup setting affects
IDE0059
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
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
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();
fun();
instead of
_ = fun();
_ = fun();
or
int unused = fun();
int unused = fun();
.
The only options I see for these variables are
discard_variable
discard_variable
and
unused_local_variable
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
IDE0059
for reference: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0059?pivots=lang-csharp-vb
Code 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.
Code style options and code cleanup - Visual Studio (Windows)
IDE0059 - .NET
Learn about code analysis style rule IDE0059.
IDE0059 - .NET
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

❔ EntityFramework Code cleanup
C#CC# / help
3y ago
✅ cleanup
C#CC# / help
16mo ago
✅ editorconfig with visual studio
C#CC# / help
3y ago
❔ How to make Rider format and cleanup code by default?
C#CC# / help
3y ago