Extract String to Resource (replace all)

Extracts the string at the caret into a resource file, and replaces all occurrences of this string with a reference to the resource string.


Available from the context menu or via shortcuts:

  • When the caret is on a string, provided that this string occurs more than once within the current member. This string should not be assigned to a constant, or be an attribute value.


  • This refactoring automatically suggests the name for the newly created resource string. You can then modify this name in the Resources browser, and the code will be updated automatically.


AddLogMessage("Default message:" + "Nice to meet you");
Responder.DefaultMessage = "Nice to meet you";
AddLogMessage("Default message:" + "Nice to meet you")
Responder.DefaultMessage = "Nice to meet you"


AddLogMessage("Default message:" + Properties.Resources.NiceToMeetYou);
Responder.DefaultMessage = Properties.Resources.NiceToMeetYou;
AddLogMessage("Default message:" + Properties.Resources.NiceToMeetYou)
Responder.DefaultMessage = Properties.Resources.NiceToMeetYou