Reputation: 1022
Is there a way to change the code generated by a quick-fix in Resharper? It doesn't seem to be in the live templates.
I'd like the 'Create Property' quickfix for an unrecognized symbol to generate
public int MyProperty { get; set; }
Instead of:
protected int MyProperty
{
get { throw new NotImplementedException(); }
set { throw new NotImplementedException(); }
}
Upvotes: 12
Views: 678
Reputation: 9382
Unfortunately you cannot define quick-fix behavior in Resharper. However, there are several options for what gets put inside the property body. Go to Resharper->Options->Languages->Common->Generated members - there are 3 options,
1) throw new NotImplemenatedException() [your example]
2) Return default value
protected int MyProperty
{
get { return 0; }
set { }
}
3) Not Compiled code
protected int MyProperty
{
get
{
???
}
set
{
???
}
}
2 is close to what you're looking for, but still not exactly.
I'd suggest instead using the "prop" Live Template - it will generate exactly what you're looking for, except that it won't do it automagically on an unrecognized symbol.
Upvotes: 4