As per subject...
"\n" is just a line feed (Unicode U+000A). This is typically the Unix line separator.
"\r\n" is a carriage return (Unicode U+000D) followed by a line feed (Unicode U+000A). This is typically the Windows line separator.
Basically comes down to Windows standard: \r\n and Unix based systems using: \n
The Difference
There are a few characters which can indicate a new line. The usual ones are these two:
* '\n' or '0x0A' (10 in decimal) -> This character is called "Line Feed" (LF).
* '\r' or '0x0D' (13 in decimal) -> This one is called "Carriage return" (CR).
Different Operating Systems handle newlines in a different way. Here is a short list of the most common ones:
* DOS and Windows
They expect a newline to be the combination of two characters, namely '\r\n' (or 13 followed by 10).
* Unix (and hence Linux as well)
Unix uses a single '\n' to indicate a new line.
* Mac
Macs use a single '\r'.
Taken from Here
It's about how operating system recognize line ends.
- windows user \r\n
- mac user \r
- linux uses \n
Morale: if you are developing for windows, stick to \r\n. Or even better, use C# string functions to deal with strings which already consider line endings (WriteLine, and such).
\n is the line break used by Unix(-like) systems, \r\n is used by windows. This has nothing to do with C#.
\n is Unix, \r is Mac, \r\n is Windows.
Sometimes it's giving trouble especially when running code cross platform. You can bypass this by using Environment.NewLine.
Please refer to http://social.msdn.microsoft.com/forums/en-US/csharplanguage/thread/47af2197-26b4-4b9e-90e8-bfa9d5cd05b4 for more information. Happy reading
They are just \r\n and \n
are variants.
\r\n
is used in windows
\n
is used in mac and linux