As the heading implies, would I be best to use \n, \r\n or System.Environment.NewLine for line breaks in my C# applications?
I have a console, WinForms and WPF app which at present all use \n (where required), but in my console app I have found that when redirecting output from the CLi and open the output in Notepad the line breaks are not correctly recognised. I could just alter my behaviour for this one app but I am seeking the advice of those who consistently use a particular method and why.
Cheers!
Update:
So the general consensus is that use System.Environment.NewLine unless a specific requirement arises which needs \n (Unix/OS X), \r (OS 9) or \r\n (Windows)
Thanks all and sorry about the dup!
Better use Environment.NewLine because
\rand\nare platform dependant.Environment.NewLinewould return any of the above based on the operating system.