【发布时间】:2023-03-09 05:54:01
【问题描述】:
假设我想在 Visual Studio 中输入:
class Program
{
private const Byte NUM_THREADS =
#if DEBUG
1;
#else
8;
#endif
}
如果我只是简单地输入它(即不手动修复任何缩进),Visual Studio 会像这样格式化它:
class Program
{
private const Byte NUM_THREADS =
#if DEBUG
1;
#else
8;
#endif
}
我能做些什么让它自动缩进,让它看起来像第一个例子吗?
【问题讨论】:
-
“只需输入”是什么意思?您是否打开了某种自动格式化模式?
-
@GregHewgill 我的意思是自己输入并只添加新行,而不是按 Tab 来添加任何手动缩进。
-
Visual Studio 工具 | Option => Text Editor => C# => Formatting 有很多选项,但看起来预处理器定义总是挂在左边(#region 除外)。
标签: c# visual-studio visual-studio-2010 c-preprocessor