Back to Devexpress

Use Environment.NewLine

coderushforroslyn-115598-refactoring-assistance-use-environment-newline.md

latest1.1 KB
Original Source

Use Environment.NewLine

  • Aug 03, 2020

Purpose

Replaces the “\r\n” string with the Environment.NewLine property value.

Availability

Available when the cursor is in the “\r\n” string.

Not available when the “\r\n” string is a part of another string.

Usage

  1. Place the caret in the “\r\n” string.

  2. Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.

  3. Select Use Environment.NewLine from the menu.

After execution, the Refactoring replaces the “\r\n” string with the Environment.NewLine property value.

csharp
string hello = "Hello World !!!" + Environment.NewLine;
vb
Dim hello As String = "Hello World !!!" & Environment.NewLine

See Also

Use String.IsNullOrEmpty

Use NameOf

Boolean to Enum