C# + ReSharper = Awesome: Tip #7–Move String to Resource

This is the seventh in a series of quick how-to articles on ReSharper.

Tip #7 – Move String to Resource

Use: Moves a string into a resource file to enable localization.

Tip: Ensure your project contains at least one Resource (resx) file or the operation will fail.

Before
   1:       public string YouRock()
   2:       {
   3:           return "No, YOU rock Mr. Method-Caller!";
   4:       }
Right-click the string –> Refactor –> Refactor This…

image

Move to Resource

SNAGHTML6f7080

After
   1:       public string YouRock()
   2:       {
   3:           return StringResources.No_YOU_rock_Mr_Method_Caller;
   4:       }

Happy coding!