newline character

  • Thread starter Thread starter John Grandy
  • Start date Start date
J

John Grandy

in VB.NET you can do

sb = New StringBuilder("Hello")
sb.Append(vbCrLf)

What is the C# analogy to vbCrLf ?
 
J.S. said:
System.Environment.NewLine

No, that's not the equivalent to vbCrLf. "\r\n" is the equivalent to
vbCrLf. Environment.NewLine is whatever the normal new line is *for the
platform you're running on* - on platforms other than Windows, it may
well not be "\r\n".
 
Just a note too that \r is carriage return and \n is line feed, so if all
you want is line feed then \n is enough. When printing to the old style
printers you can simply go down a line with the \n.

Also, note that Apple performs both a carriage return and a line feed when
you do a \n by itself, where as Microsoft requires both.

JIM
 
Back
Top