Do you format "Environment.NewLine" at the end of a line?

Loading last updated info...

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? ";

❌ Figure: 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? ";

✅ Figure: Good example -  "Environment.NewLine" is at the end of the line

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

✅ Figure: Good example - "Environment.NewLine" is an exception for String.Join\

Categories

Authors

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star