Problem to define a reordering type member layout
Hello
i am new in using resharper but i am amazed by the functions of resharper. Now i try to define a template for reordering type members in the code cleaning process. The source code is the following:
public class TestClass
{
private double _testValue;
public TestClass()
{
_testValue=0;
}
private int _count;
public int Count
{
get {return _count;}
set{_count=value; OnPropertyChanged("Count");
}
private double _controlHeight
public double ControlHeight{get {return _controlHeight; } set{_controlHeight=value;}}
public double ControlWidth{get;set;}
}
So i want that the fields a group in a region at first position. On the second position should the constructors group in regions an so on. I define the template an get the following:
public class TestClass
{
#region fields
private double _testValue;
private int _count;
private double _controlHeight
#endregion
#region constructors
public TestClass
{
_testValue=0;
}
#endregion
#region properties
#region Count
public int Count
{
get {return _count;}
set{_count=value; OnPropertyChanged("Count");
}
#endregion
#region ControlHeight
public double ControlHeight{get {return _controlHeight; } set{_controlHeight=value;}}
#endregion
#region ControlWidth
public double ControlWidth{get;set;}
#endregion
#endregion
}
It is very cool but i have a probleme to define that the backing fields are inside the region of them properties and not in the region of private fields which has no backing field function. In final template i will get the following code:
public class TestClass
{
#region fields
private double _testValue;
#endregion
#region constructors
public TestClass
{
_testValue=0;
}
#endregion
#region properties
#region Count
private int _count;
public int Count
{
get {return _count;}
set{_count=value; OnPropertyChanged("Count");
}
#endregion
#region ControlHeight
private double _controlHeight
public double ControlHeight{get {return _controlHeight; } set{_controlHeight=value;}}
#endregion
#region ControlWidth
public double ControlWidth{get;set;}
#endregion
#endregion
}
I hope you can help me too define the template in the right wy to get my rinally result.
Best regards
Daniel
Please sign in to leave a comment.