【发布时间】:2012-10-26 18:18:26
【问题描述】:
可能重复:
How to force indentation of C# conditional directives?
Can visual studio automatically indent / format preprocessing directives?
在以下示例代码中有一个#if 指令,但请注意缺少缩进:
else
{
#if DEBUG
Debug.Print(ex.Message);
#endif
return null;
}
我知道这对于某些纯开发实践来说可能是这样的,但老实说,在 VS.NET 中我不在乎,并且希望它与我的代码保持一致。有没有办法让# 指令与 VS.NET 中的其余代码内联自动缩进?
谢谢!
【问题讨论】:
-
您还应该考虑使用 ConditionalAttribute (stackoverflow.com/questions/3786827/…)
标签: c# visual-studio