Note that there are some explanatory texts on larger screens.

plurals
  1. POAuto refactoring to string.Format
    primarykey
    data
    text
    <p>I have a c# project in VS2008 that have a lot of lines of code that look like this:</p> <pre><code>string s = "bla blab" + x + "bla bla bla" + y + .... ; </code></pre> <p>and I would like to covert those strings to a single string using string.Format(...).</p> <p>I am currently using Resharper 5.0, and I can refactor a single line of code with one click. The problem is that I have more that a 1000 lines like this, and I don't want to manually go over each line.</p> <p>Is there a way to do this automatically? </p> <p>Edit: As Marc corrected me, I dont really need to do it, but I have another very similar problem: I got this code</p> <pre><code> string s = "aaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaa"; </code></pre> <p>(the string is some sql query)</p> <p>and I'd like to refactor it to one const string:</p> <pre><code>string s = "aaaaaaaaaaaaaaaaaa....aaaaa"; </code></pre> <p>(this time, it is more efficient, right?)</p> <p>resharper can do this automatically per string, but again, I'd like to do it a lot of times.</p> <p>it would be great to keep the lines indentation:</p> <pre><code>string s = @"aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa"; </code></pre> <p>but just one long line is ok too.</p> <p>thanks, Lev.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload