Visual studio 2008 如何让VS2008粘贴代码而不重新格式化(更改空白)?

Visual studio 2008 如何让VS2008粘贴代码而不重新格式化(更改空白)?,visual-studio-2008,copy-paste,Visual Studio 2008,Copy Paste,我以我喜欢的方式使用vim进行了一些代码对齐,然后尝试将其粘贴到VS2008中。瞧,2008年决定重新格式化它,删除我添加的所有空白,使一些声明完美地对齐 有没有办法让VS2008(a)粘贴而不更改空格,或者(B)按如下所示对齐代码 public int SomePropertyName { get; set; } public Nullable<string> SomeOtherProperty { get; set; } public Nullab

我以我喜欢的方式使用vim进行了一些代码对齐,然后尝试将其粘贴到VS2008中。瞧,2008年决定重新格式化它,删除我添加的所有空白,使一些声明完美地对齐

有没有办法让VS2008(a)粘贴而不更改空格,或者(B)按如下所示对齐代码

public int              SomePropertyName   { get; set; }
public Nullable<string> SomeOtherProperty  { get; set; }
public Nullable<int>    YetAnotherProperty { get; set; }
public int SomePropertyName{get;set;}
公共可为null的SomeOtherProperty{get;set;}
公共可为空的YetAnotherProperty{get;set;}
当我将其粘贴到VS2008中时,结果如下:

public int SomePropertyName { get; set; }
public Nullable<string> SomeOtherProperty { get; set; }
public Nullable<int> YetAnotherProperty { get; set; }
public int SomePropertyName{get;set;}
公共可为null的SomeOtherProperty{get;set;}
公共可为空的YetAnotherProperty{get;set;}

这是一个选项。工具+选项、文本编辑器、C#、格式化、“粘贴时自动格式化”复选框。

此外,如果您大部分时间都喜欢重新格式化,您可以选中Hans指出的选项,只需在粘贴后执行ctrl+z。它不会撤消粘贴,但会撤消代码的重新格式化。我更喜欢这种方法,因为大多数时候,重新格式化是件好事。但是,当我不喜欢结果时,ctrl+z会更好。

+1,这是更好的解决方案。我将把我的答案留给reference.VS2017-工具>选项>文本编辑器>C#>代码样式>格式