I have 2 questions
Q1:
I have read about various coding indent styles like Allman, K&R etc.
What i want to know is where is the setting in VS(2010) where all these can be set?
Q2:
When I press Ctrl + K and Ctrl + D after each other. It corrects formatting like where there are 2 spaces b/w words it reduces them to one.
Similarly is there any shortcuts that removes extra emptylines between 2 lines of codes?
My situation is that I was given a code where extra enter were pressed between 2 lines of code. How can i remove it?
Q1. Under Tools->Options->Text Editor->C#->Formatting->Indentation
change the settings as per your need.
Also check Formatting->New Lines.
Q2. There are many ways to remove blank lines
1st Solution:
1. Click Ctrl+H (quick replace)
2. Tick “Use Regular Expressions”
3. In Find specify “^$\n”
4. In Replace box delete everything.
5. Click “Replace All”
All Blank lines will be deleted. 🙂
^ Means Beginning of line
$ Means End of line
2nd Solution:
Check the VS addins like resharper or CodeMaid which does the code formatting