Re: \n?? \r??
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 09/17/04
- Next message: Ignacio Machin \( .NET/ C# MVP \): "Re: convert type 'byte' to 'bool'"
- Previous message: Jon Skeet [C# MVP]: "Re: convert type 'byte' to 'bool'"
- In reply to: Drebin: "Re: \n?? \r??"
- Next in thread: James Curran: "Re: \n?? \r??"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 13:31:57 +0100
Drebin <thedrebin@hotmail.com> wrote:
> I've seen it in countless MS docs and on countless MS blogs and
> newsgroups... Why isn't it proper?
Because it depends on whether you *actually* want it to be dependent on
your environment. For instance, many protocols specify that the newline
in the protocol *must* be "\r\n" - which isn't necessarily the value of
Environment.NewLine. (It is on the MS CLR, but it may not be on Mono,
for instance.)
Environment.NewLine does precisely what it says in the docs: "Gets the
newline string defined for this environment." In many situations you
want the newline string defined for a particular protocol. Even if that
happens to be the same on the environment you're running in, it's
better to make it explicit so that when you're running in an
environment where Environment.NewLine may return something different,
your code doesn't break.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Ignacio Machin \( .NET/ C# MVP \): "Re: convert type 'byte' to 'bool'"
- Previous message: Jon Skeet [C# MVP]: "Re: convert type 'byte' to 'bool'"
- In reply to: Drebin: "Re: \n?? \r??"
- Next in thread: James Curran: "Re: \n?? \r??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|