Home
Do you format "Environment.NewLine" at the end of a line?
  v2.0 Posted at 27/04/2018 7:55 AM by Tiago Araujo
You should format "Environment.NewLine" at the end of a line.​​

DialogResult diaResult = MessageBox.Show(this,
"The database is not valid." + Environment.NewLine + "Do you want to upgrade it? ",
"Tip",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);

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


DialogResult diaResult = MessageBox.Show(this,
"The database is not valid." + Environment.NewLine
+ "Do you want to upgrade it? ",
"Tip",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);

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:

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