问题
I'm not sure if my title is entire accurate, however, I would like to disable the feature in ReSharper formatting where it removes spaces upon formatting. The following image describes the behaviour (red = before format, green = after format)
:
As you can see the spaces before id and after fileId are removed, so:
new { id = fileId } -->
new {id = fileId}
I would like to disable this behaviour, and actually (if possible) enforce the leading and trailing space. I can't find what the option is called in the ReSharper -> Options -> C# -> Formatting Style -> Spaces tab.
Any help would be greatly appreciated
回答1:
You can keep the spacing with the option: Within single-line initializer braces.
It can be found here:
Resharper -> Options -> Code editing -> C# -> Formatting Style -> Spaces
来源:https://stackoverflow.com/questions/44630190/resharper-formatting-disable-remove-spaces-for-anonymous-object-creation