Possible Duplicate:
How to force indentation of C# conditional directives?
Can visual studio automatically indent / format preprocessing directives?
In the following sample code there is a #if directive but notice the lack of indentation:
else
{
#if DEBUG
Debug.Print(ex.Message);
#endif
return null;
}
I know this is probably like this for some pure development practice, but honestly within VS.NET I do not care and would prefer it to align with my code. Is there a way to allow # directives be auto indented inline with the rest of the code in VS.NET?
Thanks!
I tried to search something here:
but unfortunately it seems that visualstudio doesn’t have anything built in which permit you to indent the preprocessor directives in that way. However googling I found this answer and it recommends to use StyleCop. Hope this helps you.