Reputation: 6577
When I create a constructor with parameters using Resharper's 'Generate code' feature, I get something like this:
public class Example{
private int _x;
private int _y;
public Example(int _x, int _y){
this._x = _x;
this._y = _y;
}
}
I would like to use this naming convention instead:
public class Example{
private int _x;
private int _y;
public Example(int x, int y){
_x = x;
_y = y;
}
}
but I don't know if it's possible to edit this constructor template and where.
Upvotes: 0
Views: 331
Reputation: 12132
Options / Languages / Common / Naming Style You should set your field prefix to underscore.
Upvotes: 4
Reputation: 2269
That is the sample I just created:
internal class MyClass { private string myField;
public MyClass(string myField)
{
this.myField = myField;
}
}
Upvotes: 0
Reputation: 2269
Go to Resharper -> Live Templates -> C# -> find the class and the ctor templates and right click on them to make the desired adjustments ...
This may help you as well Live Templates help
Upvotes: 1