Carriage return and Line feed… Are both required in C#?

System.Environment.NewLine is the constant you are looking for – http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx which will provide environment specific combination that most programs on given OS will consider “next line of text”. In practice most of the text tools treat all variations that include \n as “new line” and you can just use it in your text “foo\nbar”. Especially … Read more

What is the difference between a “line feed” and a “carriage return”?

A line feed means moving one line forward. The code is \n.A carriage return means moving the cursor to the beginning of the line. The code is \r. Windows editors often still use the combination of both as \r\n in text files. Unix uses mostly only the \n. The separation comes from typewriter times, when you turned the wheel to move the paper to … Read more