Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

equivalent of vbCrLf in c#

I have a to do this:

AccountList.Split(vbCrLf) 

In c# AccountList is a string. How can i do?

thanks

like image 947
Luca Romagnoli Avatar asked Mar 08 '10 14:03

Luca Romagnoli


2 Answers

You are looking for System.Environment.NewLine.

On Windows, this is equivalent to \r\n though it could be different under another .NET implementation, such as Mono on Linux, for example.

like image 184
David Avatar answered Sep 21 '22 19:09

David


I typically abbreviate so that I can use several places in my code. Near the top, do something like this:

 string nl = System.Environment.NewLine; 

Then I can just use "nl" instead of the full qualification everywhere when constructing strings.

like image 36
Neil N Avatar answered Sep 20 '22 19:09

Neil N