2

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?

1
  • Tools --> Options ... --> Text Editor --> C# Commented May 17, 2012 at 7:01

2 Answers 2

2

Q1. Under Tools->Options->Text Editor->C#->Formatting->Indentation Indent Style 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

Sign up to request clarification or add additional context in comments.

Comments

0

Q1: You'll find a bunch of formatting settings under Tools-->Options-->Text Editor

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.