?
Solved

#region directive - indent contents of code within

Posted on 2007-10-10
5
Medium Priority
?
694 Views
Last Modified: 2013-11-26
Hi there.

When using the #region directive, is there a way with Visual Studio settings to indent the contents automatically?

#region "Private Methods"
private void blah()
{
}
#region

to become
#region "Private Methods"
    private void blah()
    {
    }
#region
?

I know i can indent manually, however, sometimes this work gets undone, especially with copy and paste rearranging.

cheers
0
Comment
Question by:Valimai
  • 3
  • 2
5 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20055837
As far as i know it cannot be done automatically in C#. Because if u looked at the settings
Tools-> Options-> Text Editor -> c#-> Formatting -> General
There is no automatic formatting like in VB in C#

You can try
Control + K
Control + D to autoformat it

Or
0
 
LVL 1

Author Comment

by:Valimai
ID: 20061962
Thats a nice shortcut, but it resets any tabbing out i have done. (resets anyway for different reasons and is a constant fight).
0
 
LVL 21

Assisted Solution

by:surajguptha
surajguptha earned 1000 total points
ID: 20062001
But these are the only options for autoformatting that i know off
0
 
LVL 21

Accepted Solution

by:
surajguptha earned 1000 total points
ID: 20062003
I am 95% sure that there is no other way :)
0
 
LVL 1

Author Comment

by:Valimai
ID: 20062041
thanks for your help!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Integration Management Part 2
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question