ReSharper 7.1"对具有支撑场的属性"将场移动到位

Fed*_*gui 23 c# visual-studio-2010 resharper-7.1

我最近升级到R#7.1并且我遇到了这个问题,其中To Property With Backing Field动作取代了我的支持字段并将它们移到了类的顶部.

例:

第1步:定义一个自动属性:

public class MyClass
{
    //... Lots of members here

    public int MyNewProperty {get;set;} // <- Create auto Property
}
Run Code Online (Sandbox Code Playgroud)

第2步:ReSharper的"带有支持领域的财产"

在此输入图像描述

预期结果:

public class MyClass
{
    //... Lots of members here

    private int _myNewProperty; // <- Backing field immediately above property
    public int MyNewProperty 
    {
       get
       {
           return _myNewProperty;
       }
       set
       {
           _myNewProperty = value;
       }
    }
}
Run Code Online (Sandbox Code Playgroud)

获得的结果:

public class MyClass
{
    private int _myNewProperty; // <- Backing field on top of the class

    //... Lots of members here


    public int MyNewProperty 
    {
       get
       {
           return _myNewProperty;
       }
       set
       {
           _myNewProperty = value;
       }
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经Type Members Layout通过评论"实例字段"部分来玩配置,如下所示:

<!--instance fields-->
<!--<Entry>
       <Match>
            <And>
               <Kind Is="field"/>
               <Not>
                   <Static/>
               </Not>
            </And>
       </Match>
       <Sort>
           <Readonly/>
           <Name/>
       </Sort>
    </Entry>-->
Run Code Online (Sandbox Code Playgroud)

但我仍然有同样的行为.

问:如何防止此行为并将其还原为V6.X?

Vla*_*mir 10

以下是JetBrains开发人员的俄语评论.本文致力于R#8发布.他说,在开始时将私人田地放在一起比将其放置在附近的财产更为常见.他建议在他们的反馈系统中打开票.此外,他说也许他们在版本8.1中引入了这样的设置.
简而言之,现在不可能.