Visual Studio - 删除方法之间的空格

时间:2012-07-10 22:03:46

标签: visual-studio whitespace code-formatting

叫我挑剔,但我更喜欢我的每个方法在它们之间有一个换行符。是否有任何自动方法来配置VS以修剪方法之间的换行符数。 e.g。

public void AMethod() 
{
    //code
}
//one line break
public void AnotherMethod()
{
    //code
}

通常通过各种因素,在重新分解期间,我最终会在方法之间插入几行。

public void AMethod() 
{
    //code
}
//one line break
//oh noes, more whitespace
//and a third one :s
public void AnotherMethod()
{
    //code
}

有没有办法在方法之间调整空间到1行(类似于CTRL + E + D)?

1 个答案:

答案 0 :(得分:1)

您可以快速替换(CTRL-H)并将“\ n \ n”替换为“\ n”。确保将选项设置为使用常规例外。根据空格的数量,您可能不止一次这样做。