What is vbCrLf counterpart in C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, friends,

In VB, there is a vbCrLf for a new line. What is the counterpart in C#?
Thanks.
 
Mythran said:
Environment.NewLine

No - there's a subtle difference there. Environment.NewLine won't
always give you carriage-return-line-feed which I would certainly hope
that vbCrLf will. Instead, it gives you the default newline for the
current system - which on windows is \r\n, but not on some other
platforms (where you might be running Mono or Rotor).

It's always worth making sure you know exactly which one you actually
want - if you're writing text files, Environment.NewLine is probably
correct. If you're dealing with a network protocol which specifies the
line terminator, you should use that.
 
Jon Skeet said:
No - there's a subtle difference there. Environment.NewLine won't
always give you carriage-return-line-feed which I would certainly hope
that vbCrLf will. Instead, it gives you the default newline for the
current system - which on windows is \r\n, but not on some other
platforms (where you might be running Mono or Rotor).

It's always worth making sure you know exactly which one you actually
want - if you're writing text files, Environment.NewLine is probably
correct. If you're dealing with a network protocol which specifies the
line terminator, you should use that.

Yeah, I was going to reply to myself and correct my post, but someone else
already posted it :)

Thanks,
Mythran
 
Back
Top