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!

 

Dew Drop – January 20, 2012 (#1,247)

Top Links

 

.NET / Visual Studio

 

Web Development

 

Design / Methodology / Testing

 

Silverlight / WPF / Windows Phone

 

Podcasts / Screencasts / Videos

 

Community / Events

 

Database

 

SharePoint

 

PowerShell

 

Miscellaneous

 

More Link Collections

 

The Geek Shelf

Rocket Surgery Made Easy: The Do-It-Yourself Guide to Finding and Fixing Usability Problems by Steve Krug

 

Dew Drop – January 19, 2012 (#1,246)

Top Links

 

.NET / Visual Studio

 

Web Development

 

Design / Methodology / Testing

 

Silverlight / WPF / Windows Phone

 

Podcasts / Screencasts / Videos

 

Community / Events

 

Database

 

Miscellaneous

 

More Link Collections

 

The Geek Shelf

Programming Entity Framework: Code First: Code First by Julia Lerman