Home All Groups Group Topic Archive Search About

vbNewLine or ControlChars.NewLine

Author
22 Nov 2007 2:29 AM
Lou
Which is more efficient?
-Lou

Author
22 Nov 2007 3:41 AM
Stephany Young
Neither are more efficient as they are both constants.

But ...

    Environment.NewLine

is more correct as it represents whatever a newline actually is on the
machine/OS where the program is executing.



Show quoteHide quote
"Lou" <lou.gar***@comcast.net> wrote in message
news:OXzbB%23KLIHA.5764@TK2MSFTNGP06.phx.gbl...
> Which is more efficient?
> -Lou
>
Author
23 Nov 2007 1:00 AM
Lou
cool!
Thanks.

Show quoteHide quote
"Stephany Young" <noone@localhost> wrote in message
news:%2330yWmLLIHA.3940@TK2MSFTNGP05.phx.gbl...
> Neither are more efficient as they are both constants.
>
> But ...
>
>    Environment.NewLine
>
> is more correct as it represents whatever a newline actually is on the
> machine/OS where the program is executing.
>
>
>
> "Lou" <lou.gar***@comcast.net> wrote in message
> news:OXzbB%23KLIHA.5764@TK2MSFTNGP06.phx.gbl...
>> Which is more efficient?
>> -Lou
>>
>
Author
23 Nov 2007 1:07 AM
Herfried K. Wagner [MVP]
"Stephany Young" <noone@localhost> schrieb:
> Neither are more efficient as they are both constants.
>
> But ...
>
>    Environment.NewLine
>
> is more correct as it represents whatever a newline actually is on the
> machine/OS where the program is executing.

I don't think it is "more correct" in general.  Which one is more correct
depends on the exact scenario.  Would you expect a Windows Forms
implementation for UNIX use CR+LF as Windows does or would you expect it to
use the system's "native" new line sequence?  Note that data displayed in
controls, for example, can be loaded from resources too.  Changing the new
line character sequence based on the system would make porting applications
between different operating systems harder.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>