简体   繁体   English

我可以让 Visual Studio 2017 停止缩进大括号吗?

[英]Can I make Visual Studio 2017 stop indenting braces for case?

Visual Studio indents braces in case like this:在这种情况下,Visual Studio 会缩进大括号:

switch(variable)
{
    case 0:
        {
            // some code
            break;
        }
}

However I would like it better without indentation:但是我更喜欢没有缩进:

switch(variable)
{
    case 0:
    {
        // some code
        break;
    }
}

I was looking through the options, but didn't find the one I want.我正在浏览选项,但没有找到我想要的选项。 Did I miss it or is it just not there?我是否错过了它,或者它只是不存在?

Under Visual Studio在 Visual Studio 下

Options >> TextEditor >> C# >> Code Style >> Formatting >> Indentation选项 >> 文本编辑器 >> C# >> 代码样式 >> 格式 >> 缩进

is what you are looking for.就是你要找的。 You will see several options under that menu and set your settings as you wish.您将在该菜单下看到多个选项,并根据需要设置您的设置。 In this case, the setting is called "Indent case contents" .在这种情况下,该设置称为“缩进大小写内容”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在创作和重构时,如何在Visual Studio 2017中使属性访问器全部包含一行,包括右括号? - How do I make property accessors all on one line, including closing braces, in Visual Studio 2017, both when authoring and refactoring? 在Visual Studio 2017设置中丢失-如何设置缩进? - Lost in Visual Studio 2017 settings — how to set up indenting? 我如何阻止 Visual Studio 2017 在保存时构建 - How do i stop visual studio 2017 from building on save 如何在仍然引用 NUnit 的同时使我的 Visual Studio 2017 项目不是测试项目 - How can I make my visual studio 2017 project NOT a test project while still referencing NUnit 重新安装Visual Studio 2010后,缩进已更改 - Indenting changed after I re-installed Visual Studio 2010 我无法在Visual Studio 2017中创建Android或iPhone项目 - I can't create Android or iPhone project in Visual Studio 2017 我可以在Visual Studio 2017和.NET 4.7中使用“ Roslyn”吗? - Can I use “Roslyn” in Visual Studio 2017 with .NET 4.7? 如何在 Visual Studio 2017 中使用 gRPC 模板? - How can I use the gRPC template in Visual Studio 2017? 如何让Visual Studio 2017以交互方式调试此行? - How can I get Visual Studio 2017 to interactively debug this line? 如何在 Visual Studio 2017 中使用 C# 8? - How can I use C# 8 with Visual Studio 2017?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM