Possible duplicate:
Shortcut string.format
In our large code base, unfortunately, there are many such statements:
MessageBox.Show("Hello, " + userName + "!");
Obviously, it would be better to facilitate the externalization of strings:
MessageBox.Show(String.Format("Hello, {0}!", userName));
Is there any tool that can automate this task (convert string concatenation to String.Format)?
If not, I believe it is necessary to find a parser that builds a syntax tree for a given C # source file, find expressions that perform string concatenations in this tree (doesn't seem easy) and convert the found occurrences?
EDIT : DevExpress CodeRush does exactly what I want - pretty cool. But, unfortunately, it only works with the current source file, and I have to click every appearance of it (or, as it seems). I would like to have an operation in all of my source files (for example, with Replace All).
source share