Murali:
Like José said, Environment.NewLine is
the best way for general use.
In certain circumstances (writing files for other
platforms) it's necessary to control how a newline
is created.
Environment.NewLine basically returns a
Carriage Return (CR, 0x13) and a
Linefeed(LF, 0x10). Carriage return moves the
cursor back to column 0, and Linefeed moves
the cursor to the next row.
Windows generally uses CRLF to represent a
new line. Unix/Linux just uses LF, and
MacOS used to use CR. Now adays, most
platforms can use anything, but if you
open a Unix file in Notepad, for example,
you won't see the line breaks, everything
will be on one line.
In C#, you can represent these special
characters as "escape" characters. For
example, \r is CR, \n LF, \t TAB, \0 null,
etc.
If you want a CRLF in your string, you'd
do this:
string foo = "This is some text\r\nNew Line!";
But for the cases where you don't need
a special platform specific code, use
Environment.NewLine.
-c