I use Rider
. What I would like to do is to replace var
with explicit type after using Reformat and cleanup code
.
For example, I have the following code snippet:
var number = 1;
I've set the following settings to apply explicit types:
However, after using Reformat and cleanup code
my code still uses var
:
var number = 1;
But I would like to have explicit type:
int number = 1;
Do you know what settings should be ticked to have explicit types after using Reformat and cleanup code
?
I was able to configure this was via setting up the var
style to always explicitly specify type. For example via the editorconfig file:
root = true
[*.cs]
csharp_style_var_for_built_in_types = false
csharp_style_var_when_type_is_apparent = false
csharp_style_var_elsewhere = false
And then enabling "apply var
style" option for clean up action:
See also: