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(); }
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With