In the world of .NET, the Right Way to include newlines in a string is with the Environment.NewLine constant. Of course, given how easy "\n" is, few developers actually follow this rule.
// The Right Way myString = "Line1" + Environment.NewLine + "Line2" + Environment.NewLine + "Line3"; // The Way Everyone Does It myString = "Line1\nLine2\nLine3";
And since "\n" works in many cases, why even bother with the codeier way? Well, one developer - Vasko's predecessor - wouldn't stand for the Easy Way. He wasn't quite a fan of the Right Way, so he came up with his own way...
public static string CRLF { get { char chrCR = (char)13; string strCR = chrCR.ToString(); char chrLF = (char)10; string strLF = chrLF.ToString(); string strCRLF = strCR + strLF; return strCRLF; } }
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!