Visual Studio格式化新行C#方法

时间:2015-06-18 07:49:43

标签: visual-studio-2013

我不想将开括号放在方法的新行上。 所以我没有选中以下复选框:

工具>选项> C#>格式化>新行>在方法的新行上放置左大括号

{
  "query" :{
  "filtered": {
    "query": {
      "match_all": { }
    },
   "filter": {
      "bool" : {
            "must" : [
                {"term" : { "macAddr.raw" : "000A8D810F5A" } },
                {"term" : { "insturmentName.raw" : "Amin's furnace" } },
                {"term" : { "instrumentAddress.raw" : "8D810F5A"}},
                {"term" : { "uhhVersion.raw" :  "v2.5"}},
                {"term" : { "groupName.raw" :  "Amin's Group"}},
                {"term" : { "groupNo" :  2}},
                {"term" : { "instrType" :  60}}
            ]
         }
    }
  }
  }
}

当我按下}键

时我想要这个
protected void MyMethod() 
{
}

1 个答案:

答案 0 :(得分:0)

您需要在工具/选项中设置另一个选项,以便在输入}字符时激活格式。

取消选中 C#/格式化/环绕部分中的单行保留选项。

The Leave Block on Single Line option enter image description here