Home
Do you format "Environment.NewLine" at the end of a line?
  v3.0 Posted at 30/01/2020 10:23 AM by Liam Elliott
You should format "Environment.NewLine" at the end of a line.​​

string message = "The database is not valid." + Environment.NewLine + "Do you want to upgrade it? ";

Bad Example: "Environment.NewLine" isn't at the end of the line


string message = "The database is not valid." + Environment.NewLine;
message += "Do you want to upgrade it? ";​

Good Example:  "Environment.NewLine" is at the end of the line

​​

return string.Join(Environment.NewLine, paragraphs);

Good Example: ​"Environment.NewLine" is an exception for String.Join


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: