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?
| 归档时间: |
|
| 查看次数: |
2379 次 |
| 最近记录: |