Visual Studio 2005/2012:如何使第一个大括号保持在同一行上? [英] Visual Studio 2005/2012: How to keep first curly brace on same line?
本文介绍了Visual Studio 2005/2012:如何使第一个大括号保持在同一行上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图让我的css/C#函数看起来像这样:
Trying to get my css / C# functions to look like this:
body {
color:#222;
}
代替此:
body
{
color:#222;
}
当我自动设置代码格式时.
when I auto-format the code.
推荐答案
C#
- 在工具菜单中,单击选项
- 单击显示所有参数(左下方的复选框)(在VS 2010中显示显示所有设置)
- 文本编辑器
- C#
- 格式化
- 换行
- In the Tools Menu click Options
- Click Show all Parameters (checkbox at the bottom left) (Show all settings in VS 2010)
- Text Editor
- C#
- Formatting
- New lines
在那里检查是否需要带括号的新行
And there check when you want new lines with brackets
CSS:
几乎相同,但选项更少
- 在工具菜单中,单击选项
- 单击显示所有参数(左下方的复选框)(在VS 2010中显示显示所有设置)
- 文本编辑器
- CSS
- 格式化
- In the Tools Menu click Options
- Click Show all Parameters (checkbox at the bottom left) (Show all settings in VS 2010)
- Text Editor
- CSS
- Format
然后选择所需的格式(在您的情况下,选择第二个单选按钮)
And than you select the formatting you want (in your case second radio button)
对于Visual Studio 2015:
工具→选项
在边栏中,转到文本编辑器→C#→格式→新行
In the sidebar, go to Text Editor → C# → Formatting → New Lines
并取消选中括号的换行选项"
这篇关于Visual Studio 2005/2012:如何使第一个大括号保持在同一行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文