Home
Do you use Environment.NewLine to make a new line in your string?
  v1.0 Posted at 27/04/2018 8:50 AM by Tiago Araujo
When you need to create a new line in your string, make sure you use Environment.NewLine, and then literally begin typing your code on a new line for readability purposes.​

String strExample = "This is a very long string that is \r\n not properly implementing a new line.";

Bad Example: The string has implemented a manual carriage return line feed pair (\r\n)

String strExample = "This is a very long string that is " + Environment.NewLine +
" properly implementing a new line.";

Good Example: The new line is created with Enviroment.NewLine

​​

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments:

    Note: Social Media login for Yotpo is not working in IE or Safari, please use Chrome. We are waiting for Yotpo to fix it.