简体   繁体   English

更改Visual Studio 2012 C#模数格式

[英]Change Visual Studio 2012 C# Modulus Format

How do you change Visual Studio's options for formatting the modulus (%) operator? 如何更改Visual Studio的格式化模数(%)运算符的选项?

For example, whenever I type the line 例如,每当我键入行

int x = a % b;

Visual Studio changes it to Visual Studio将其更改为

int x = a%b;

when I type the semi-colon. 当我输入分号时。 I would prefer that it automatically add spaces around the modulus operator instead of take them away. 我宁愿它自动在模数运算符周围添加空格而不是将它们带走。

tools -> options -> text editor -> c# -> formatting -> spacing: 工具 - >选项 - >文本编辑器 - > c# - >格式化 - >间距:

在此输入图像描述

Turns out Resharper was the culprit. 原来,Resharper是罪魁祸首。 Went to Resharper >> Options... >> Code Editing >> C# >> Formatting Style >> Spaces >> Around Operators >> Multiplicative operators. 去Resharper >>选项... >>代码编辑>> C#>>格式化样式>>空格>>运算符周围>>乘法运算符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM