Skip to main content

Use Environment.NewLine

Replaces the “\r\n” string with the Environment.NewLine constant reference.

#Availability

Available from the context menu or via shortcuts:

  • when the cursor is on the “\r\n” string.

Note

If the “\r\n” string is a part of another string (e.g. “\r\n test string”) the refactoring is unavailable.

#Examples

string str = "\r\n";
Dim str As String = "\r\n"

Result:

string str = Environment.NewLine;
Dim str As String = Environment.NewLine

#Screenshot

rsUseEnvironmentNewLine