I found the opposite here, but I need to frequently change from auto-property to full property - would it be possible to automate that (and with a shortcut perhaps):
From Auto-Property
public string FirstName { get; set; }
To Property with Backing Field
private string _firstName;
public string FirstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
}
}
Obviously, I would then change the full property further ...
Place your cursor on the property name, then wait a second or two. Press the Resharper hotkey sequence (Alt-Enter) and the second option should be "To property with backing field" which is what you want.
Alternatively, you can click the "hammer" icon in the left margin to get the option.
To make it work (ALT-Enter) you must to configure resharper keyboard schema. VS -> Tools -> Options -> ReSharper -> General -> Options -> Keyboard and menus -> Resharper keyboard Schema -> Visual Studio
来源:https://stackoverflow.com/questions/10726918/resharper-convert-auto-property-to-full-property