本文介绍了如何在代码中缩进#if指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!在下面的示例代码中,有一个#if指令,但请注意缺少缩进: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; }我知道对于某些 pure 开发实践来说可能就是这样,但是老实说,在VS.NET中,我不在乎,并且希望它与我的代码保持一致.有没有办法允许#指令与VS.NET中的其余代码自动内联缩进?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?谢谢!推荐答案我试图在此处搜索内容:I tried to search something here:,但是不幸的是,visualstudio似乎没有内置任何东西,可以让您以这种方式缩进预处理器指令.但是,我在谷歌上搜索了此答案,它建议使用 StyleCop .希望对您有帮助.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. 这篇关于如何在代码中缩进#if指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-18 09:38