Link to home
Start Free TrialLog in
Avatar of Valimai
Valimai

asked on

#region directive - indent contents of code within

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
Avatar of surajguptha
surajguptha
Flag of United States of America image

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
Avatar of Valimai
Valimai

ASKER

Thats a nice shortcut, but it resets any tabbing out i have done. (resets anyway for different reasons and is a constant fight).
SOLUTION
Avatar of surajguptha
surajguptha
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Valimai

ASKER

thanks for your help!