Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Visual Studio 2012 C# Modulus Format

How do you change Visual Studio's options for formatting the modulus (%) operator?

For example, whenever I type the line

int x = a % b;

Visual Studio changes it to

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.

like image 258
MageWind Avatar asked Dec 12 '22 16:12

MageWind


2 Answers

tools -> options -> text editor -> c# -> formatting -> spacing:

enter image description here

like image 173
Alex Avatar answered Dec 14 '22 07:12

Alex


Turns out Resharper was the culprit. Went to Resharper >> Options... >> Code Editing >> C# >> Formatting Style >> Spaces >> Around Operators >> Multiplicative operators.

like image 31
MageWind Avatar answered Dec 14 '22 05:12

MageWind