ReSharper 2017.2 Help

Splitting Lines with String Literals

When you type long sting literals, ReSharper helps you split the lines adding the necessary quotation marks and plus signs.

While the caret is within a string literal,

/help/img/dotnet/2017.2/split_literal_1.png
pressing Enter will split the string correctly so that your code syntax does not get broken:
/help/img/dotnet/2017.2/split_literal_2.png

Now, if you delete the + sign, the string parts will be back together without redundant quotes.

Another way of splitting a string literal is to set the caret where you want to split the string, press Alt+Enter and choose Split string. This context action will also add necessary quotation marks and +, but both parts of the sting will stay on the same line.

This feature is supported in the following languages and technologies:

Language: C#
Language: VB.NET
Language: C++
Language: HTML
Language: ASP.NET
Language: Razor
Language: JavaScript
Language: TypeScript
Language: CSS
Language: XML
Language: XAML
Language: Resx
Language: Build Scripts
Language: Protobuf
Language: JSON
Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is available Feature is available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available Feature is not available

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section. Specifically:

Last modified: 20 October 2017

See Also