可能重複:
How to force indentation of C# conditional directives?
Can visual studio automatically indent/format preprocessing directives?如何在代碼中縮進#if指令?
在下面的示例代碼中有一個#if
的指令,但注意到缺乏縮進:
else
{
#if DEBUG
Debug.Print(ex.Message);
#endif
return null;
}
我知道這可能是這樣的一些純開發實踐,但誠實地在VS.NET內我不在乎,並希望它與我的代碼一致。有沒有辦法讓#
指令自動縮進與VS.NET中的其他代碼?
謝謝!
可能的重複:http://stackoverflow.com/questions/10548319/can-visual-studio-automatically-indent-format-preprocessing-directives,http://stackoverflow.com/questions/1321228/how-to- force-indentation of c-sharp-conditional-directives –
您還應該考慮使用ConditionalAttribute(http://stackoverflow.com/questions/3786827/alternatives-to-conditional-compilation-in-c-sharp) – Surfbutler